From bb97421ef462f3dbc1cefa7a0742d5045922b271 Mon Sep 17 00:00:00 2001 From: Tim Schrodi Date: Sun, 3 Mar 2024 14:31:37 +0100 Subject: [PATCH] (#23) Switch to equinix sdk and remove facility usage --- go.mod | 2 +- go.sum | 10 +- pkg/mock/equinixmetal.go | 139 +- pkg/provider/apis/provider_spec.go | 3 +- pkg/provider/apis/validation/validation.go | 2 +- pkg/provider/core.go | 148 +- pkg/provider/core_test.go | 3 +- pkg/spi/equinixmetal.go | 58 +- pkg/spi/spi.go | 20 +- .../github.com/equinix/equinix-sdk-go/LICENSE | 22 + .../services/metalv1}/.gitignore | 6 - .../metalv1/.openapi-generator-ignore | 23 + .../equinix-sdk-go/services/metalv1/README.md | 733 ++++ .../services/metalv1/api_authentication.go | 922 +++++ .../services/metalv1/api_batches.go | 643 +++ .../services/metalv1/api_bgp.go | 1103 ++++++ .../services/metalv1/api_capacity.go | 848 ++++ .../metalv1/api_console_log_details.go | 175 + .../services/metalv1/api_devices.go | 3498 +++++++++++++++++ .../services/metalv1/api_emails.go | 632 +++ .../services/metalv1/api_events.go | 1817 +++++++++ .../services/metalv1/api_facilities.go | 520 +++ .../services/metalv1/api_firmware_sets.go | 320 ++ .../metalv1/api_hardware_reservations.go | 800 ++++ .../services/metalv1/api_incidents.go | 155 + .../services/metalv1/api_interconnections.go | 2477 ++++++++++++ .../services/metalv1/api_invitations.go | 482 +++ .../services/metalv1/api_invoices.go | 332 ++ .../services/metalv1/api_ip_addresses.go | 1235 ++++++ .../services/metalv1/api_licenses.go | 908 +++++ .../services/metalv1/api_memberships.go | 505 +++ .../services/metalv1/api_metal_gateways.go | 1103 ++++++ .../services/metalv1/api_metros.go | 276 ++ .../services/metalv1/api_operating_systems.go | 271 ++ .../services/metalv1/api_organizations.go | 2597 ++++++++++++ .../services/metalv1/api_otps.go | 745 ++++ .../metalv1/api_password_reset_tokens.go | 292 ++ .../services/metalv1/api_payment_methods.go | 472 +++ .../services/metalv1/api_plans.go | 368 ++ .../services/metalv1/api_ports.go | 2416 ++++++++++++ .../services/metalv1/api_projects.go | 1911 +++++++++ .../metalv1/api_self_service_reservations.go | 476 +++ .../services/metalv1/api_spot_market.go | 1142 ++++++ .../services/metalv1/api_ssh_keys.go | 1263 ++++++ .../services/metalv1/api_support_request.go | 180 + .../services/metalv1/api_transfer_requests.go | 460 +++ .../services/metalv1/api_two_factor_auth.go | 533 +++ .../services/metalv1/api_usages.go | 342 ++ .../metalv1/api_user_verification_tokens.go | 312 ++ .../services/metalv1/api_userdata.go | 156 + .../services/metalv1/api_users.go | 1175 ++++++ .../services/metalv1/api_vlans.go | 770 ++++ .../services/metalv1/api_vrfs.go | 2767 +++++++++++++ .../equinix-sdk-go/services/metalv1/client.go | 842 ++++ .../services/metalv1/configuration.go | 218 + ...l_activate_hardware_reservation_request.go | 154 + .../services/metalv1/model_address.go | 373 ++ .../services/metalv1/model_attribute.go | 269 ++ .../services/metalv1/model_attribute_data.go | 269 ++ .../services/metalv1/model_auth_token.go | 415 ++ .../metalv1/model_auth_token_input.go | 191 + .../services/metalv1/model_auth_token_list.go | 154 + .../metalv1/model_auth_token_project.go | 822 ++++ .../services/metalv1/model_auth_token_user.go | 932 +++++ .../services/metalv1/model_batch.go | 414 ++ .../services/metalv1/model_batches_list.go | 154 + .../services/metalv1/model_bgp_config.go | 620 +++ .../model_bgp_config_deployment_type.go | 111 + .../metalv1/model_bgp_config_request_input.go | 273 ++ ...gp_config_request_input_deployment_type.go | 111 + .../metalv1/model_bgp_config_status.go | 113 + .../metalv1/model_bgp_dynamic_neighbor.go | 491 +++ ...model_bgp_dynamic_neighbor_create_input.go | 235 ++ .../model_bgp_dynamic_neighbor_list.go | 191 + .../model_bgp_dynamic_neighbor_state.go | 115 + .../metalv1/model_bgp_neighbor_data.go | 497 +++ .../services/metalv1/model_bgp_route.go | 191 + .../services/metalv1/model_bgp_session.go | 465 +++ .../model_bgp_session_address_family.go | 111 + .../metalv1/model_bgp_session_input.go | 196 + .../model_bgp_session_input_address_family.go | 111 + .../metalv1/model_bgp_session_list.go | 154 + .../metalv1/model_bgp_session_neighbors.go | 155 + .../services/metalv1/model_bond_port_data.go | 193 + .../model_capacity_check_per_facility_info.go | 265 ++ .../model_capacity_check_per_facility_list.go | 154 + .../model_capacity_check_per_metro_info.go | 269 ++ .../model_capacity_check_per_metro_list.go | 154 + .../services/metalv1/model_capacity_input.go | 154 + .../model_capacity_level_per_baremetal.go | 154 + .../services/metalv1/model_capacity_list.go | 154 + .../services/metalv1/model_component.go | 536 +++ .../services/metalv1/model_coordinates.go | 191 + .../metalv1/model_create_device_request.go | 146 + .../metalv1/model_create_email_input.go | 167 + .../model_create_metal_gateway_request.go | 146 + ...te_organization_interconnection_request.go | 176 + ...create_self_service_reservation_request.go | 266 ++ ...self_service_reservation_request_period.go | 191 + ...ervice_reservation_request_period_count.go | 111 + ...service_reservation_request_period_unit.go | 109 + .../model_dedicated_port_create_input.go | 556 +++ .../model_dedicated_port_create_input_mode.go | 111 + .../model_dedicated_port_create_input_type.go | 109 + .../services/metalv1/model_device.go | 1721 ++++++++ .../metalv1/model_device_action_input.go | 357 ++ .../metalv1/model_device_action_input_type.go | 117 + .../metalv1/model_device_actions_inner.go | 191 + .../model_device_create_in_facility_input.go | 1128 ++++++ .../model_device_create_in_metro_input.go | 1124 ++++++ .../metalv1/model_device_create_input.go | 1094 ++++++ ...model_device_create_input_billing_cycle.go | 115 + .../metalv1/model_device_created_by.go | 503 +++ .../metalv1/model_device_health_rollup.go | 193 + ...odel_device_health_rollup_health_rollup.go | 113 + .../services/metalv1/model_device_list.go | 191 + .../services/metalv1/model_device_metro.go | 265 ++ .../metalv1/model_device_project_lite.go | 167 + .../services/metalv1/model_device_state.go | 127 + .../metalv1/model_device_update_input.go | 564 +++ .../services/metalv1/model_device_usage.go | 228 ++ .../metalv1/model_device_usage_list.go | 154 + .../services/metalv1/model_disk.go | 228 ++ .../services/metalv1/model_email.go | 302 ++ .../services/metalv1/model_email_input.go | 204 + .../services/metalv1/model_entitlement.go | 562 +++ .../services/metalv1/model_error.go | 193 + .../services/metalv1/model_event.go | 488 +++ .../services/metalv1/model_event_list.go | 191 + .../metalv1/model_fabric_service_token.go | 343 ++ .../model_fabric_service_token_role.go | 111 + ...fabric_service_token_service_token_type.go | 111 + .../model_fabric_service_token_state.go | 113 + .../services/metalv1/model_facility.go | 377 ++ .../metalv1/model_facility_features_inner.go | 117 + .../services/metalv1/model_facility_input.go | 172 + .../services/metalv1/model_facility_list.go | 154 + .../services/metalv1/model_filesystem.go | 154 + ...find_facilities_include_parameter_inner.go | 111 + ...odel_find_ip_address_by_id_200_response.go | 176 + ...l_find_ip_availabilities_cidr_parameter.go | 325 ++ ...d_ip_reservations_types_parameter_inner.go | 117 + ...l_find_metal_gateway_by_id_200_response.go | 146 + ...tion_devices_categories_parameter_inner.go | 117 + ...l_find_organizations_personal_parameter.go | 113 + .../model_find_plans_type_parameter.go | 113 + ...re_reservations_provisionable_parameter.go | 109 + ...t_hardware_reservations_state_parameter.go | 113 + .../model_find_traffic_bucket_parameter.go | 111 + .../model_find_traffic_direction_parameter.go | 111 + .../model_find_traffic_interval_parameter.go | 127 + .../model_find_traffic_timeframe_parameter.go | 197 + .../services/metalv1/model_firmware_set.go | 351 ++ .../model_firmware_set_list_response.go | 345 ++ .../metalv1/model_firmware_set_response.go | 154 + .../metalv1/model_global_bgp_range.go | 302 ++ .../metalv1/model_global_bgp_range_list.go | 154 + .../metalv1/model_hardware_reservation.go | 643 +++ .../model_hardware_reservation_list.go | 191 + .../services/metalv1/model_href.go | 167 + .../model_instances_batch_create_input.go | 154 + ...tances_batch_create_input_batches_inner.go | 1233 ++++++ .../services/metalv1/model_interconnection.go | 825 ++++ .../metalv1/model_interconnection_list.go | 191 + .../metalv1/model_interconnection_mode.go | 111 + .../metalv1/model_interconnection_port.go | 488 +++ .../model_interconnection_port_list.go | 154 + .../model_interconnection_port_role.go | 111 + .../model_interconnection_port_status.go | 117 + .../model_interconnection_redundancy.go | 111 + .../metalv1/model_interconnection_type.go | 111 + .../model_interconnection_update_input.go | 302 ++ .../services/metalv1/model_invitation.go | 525 +++ .../metalv1/model_invitation_input.go | 315 ++ .../services/metalv1/model_invitation_list.go | 154 + .../metalv1/model_invitation_roles_inner.go | 115 + .../services/metalv1/model_invoice.go | 635 +++ .../services/metalv1/model_invoice_list.go | 154 + .../services/metalv1/model_ip_address.go | 272 ++ .../model_ip_address_address_family.go | 111 + .../services/metalv1/model_ip_assignment.go | 859 ++++ .../metalv1/model_ip_assignment_input.go | 204 + .../metalv1/model_ip_assignment_list.go | 154 + .../metalv1/model_ip_assignment_metro.go | 265 ++ .../metalv1/model_ip_assignment_state.go | 113 + .../metalv1/model_ip_assignment_type.go | 109 + .../model_ip_assignment_update_input.go | 228 ++ .../metalv1/model_ip_availabilities_list.go | 154 + .../services/metalv1/model_ip_reservation.go | 1166 ++++++ .../metalv1/model_ip_reservation_facility.go | 377 ++ .../metalv1/model_ip_reservation_list.go | 191 + ..._ip_reservation_list_ip_addresses_inner.go | 104 + .../metalv1/model_ip_reservation_metro.go | 265 ++ .../model_ip_reservation_request_input.go | 456 +++ .../metalv1/model_ip_reservation_type.go | 115 + .../services/metalv1/model_license.go | 339 ++ .../metalv1/model_license_create_input.go | 228 ++ .../services/metalv1/model_license_list.go | 154 + .../metalv1/model_license_update_input.go | 191 + .../services/metalv1/model_line_item.go | 376 ++ .../services/metalv1/model_membership.go | 377 ++ .../metalv1/model_membership_input.go | 154 + .../services/metalv1/model_membership_list.go | 154 + .../services/metalv1/model_meta.go | 413 ++ .../services/metalv1/model_metadata.go | 788 ++++ .../metalv1/model_metadata_network.go | 228 ++ .../metalv1/model_metadata_network_network.go | 154 + .../model_metadata_network_network_bonding.go | 228 ++ .../services/metalv1/model_metal_gateway.go | 451 +++ .../model_metal_gateway_create_input.go | 244 ++ ...l_metal_gateway_elastic_ip_create_input.go | 274 ++ .../metalv1/model_metal_gateway_list.go | 191 + ...metal_gateway_list_metal_gateways_inner.go | 104 + .../metalv1/model_metal_gateway_lite.go | 379 ++ .../metalv1/model_metal_gateway_state.go | 113 + .../services/metalv1/model_metro.go | 265 ++ .../services/metalv1/model_metro_input.go | 168 + .../services/metalv1/model_metro_list.go | 154 + .../services/metalv1/model_mount.go | 265 ++ ...model_move_hardware_reservation_request.go | 154 + .../services/metalv1/model_new_password.go | 154 + .../metalv1/model_operating_system.go | 528 +++ .../metalv1/model_operating_system_list.go | 154 + .../services/metalv1/model_organization.go | 748 ++++ .../metalv1/model_organization_input.go | 453 +++ .../metalv1/model_organization_list.go | 191 + .../services/metalv1/model_otp_seed.go | 155 + .../services/metalv1/model_parent_block.go | 265 ++ .../services/metalv1/model_partition.go | 228 ++ .../services/metalv1/model_payment_method.go | 673 ++++ .../model_payment_method_billing_address.go | 228 ++ .../model_payment_method_create_input.go | 233 ++ .../metalv1/model_payment_method_list.go | 154 + .../model_payment_method_update_input.go | 339 ++ .../services/metalv1/model_plan.go | 639 +++ .../metalv1/model_plan_available_in_inner.go | 192 + .../model_plan_available_in_inner_price.go | 154 + .../model_plan_available_in_metros_inner.go | 192 + .../model_plan_deployment_types_inner.go | 111 + .../services/metalv1/model_plan_list.go | 154 + .../services/metalv1/model_plan_specs.go | 302 ++ .../metalv1/model_plan_specs_cpus_inner.go | 191 + .../metalv1/model_plan_specs_drives_inner.go | 265 ++ .../model_plan_specs_drives_inner_category.go | 113 + .../metalv1/model_plan_specs_features.go | 228 ++ .../metalv1/model_plan_specs_memory.go | 154 + .../metalv1/model_plan_specs_nics_inner.go | 191 + .../services/metalv1/model_plan_type.go | 113 + .../services/metalv1/model_port.go | 488 +++ .../metalv1/model_port_assign_input.go | 155 + .../model_port_convert_layer3_input.go | 154 + ..._convert_layer3_input_request_ips_inner.go | 191 + .../services/metalv1/model_port_data.go | 193 + .../metalv1/model_port_network_type.go | 117 + .../services/metalv1/model_port_type.go | 111 + .../metalv1/model_port_vlan_assignment.go | 414 ++ .../model_port_vlan_assignment_batch.go | 451 +++ ...port_vlan_assignment_batch_create_input.go | 154 + ...tch_create_input_vlan_assignments_inner.go | 228 ++ .../model_port_vlan_assignment_batch_list.go | 154 + .../model_port_vlan_assignment_batch_state.go | 115 + ...assignment_batch_vlan_assignments_inner.go | 265 ++ ...ment_batch_vlan_assignments_inner_state.go | 111 + .../model_port_vlan_assignment_list.go | 154 + .../model_port_vlan_assignment_state.go | 111 + .../services/metalv1/model_project.go | 822 ++++ .../model_project_create_from_root_input.go | 353 ++ ...del_project_create_from_root_input_type.go | 111 + .../metalv1/model_project_create_input.go | 316 ++ .../services/metalv1/model_project_id_name.go | 191 + .../services/metalv1/model_project_list.go | 191 + .../services/metalv1/model_project_type.go | 111 + .../metalv1/model_project_update_input.go | 303 ++ .../services/metalv1/model_project_usage.go | 450 +++ .../metalv1/model_project_usage_list.go | 154 + .../services/metalv1/model_raid.go | 228 ++ .../metalv1/model_recovery_code_list.go | 154 + ...del_request_ip_reservation_201_response.go | 146 + .../model_request_ip_reservation_request.go | 146 + ...l_self_service_reservation_item_request.go | 302 ++ ..._self_service_reservation_item_response.go | 524 +++ .../model_self_service_reservation_list.go | 154 + ...model_self_service_reservation_response.go | 525 +++ .../services/metalv1/model_server_info.go | 272 ++ .../metalv1/model_spot_market_prices_list.go | 154 + ...model_spot_market_prices_per_metro_list.go | 154 + ...del_spot_market_prices_per_metro_report.go | 376 ++ .../metalv1/model_spot_market_request.go | 525 +++ .../model_spot_market_request_create_input.go | 382 ++ ...equest_create_input_instance_parameters.go | 786 ++++ .../metalv1/model_spot_market_request_list.go | 154 + .../model_spot_market_request_metro.go | 265 ++ .../metalv1/model_spot_prices_datapoints.go | 154 + .../model_spot_prices_history_report.go | 154 + .../model_spot_prices_per_baremetal.go | 154 + .../metalv1/model_spot_prices_per_facility.go | 450 +++ .../model_spot_prices_per_new_facility.go | 154 + .../metalv1/model_spot_prices_report.go | 635 +++ .../services/metalv1/model_ssh_key.go | 451 +++ .../metalv1/model_ssh_key_create_input.go | 266 ++ .../services/metalv1/model_ssh_key_input.go | 228 ++ .../services/metalv1/model_ssh_key_list.go | 154 + .../services/metalv1/model_storage.go | 228 ++ .../metalv1/model_support_request_input.go | 307 ++ .../model_support_request_input_priority.go | 115 + .../metalv1/model_transfer_request.go | 340 ++ .../metalv1/model_transfer_request_input.go | 154 + .../metalv1/model_transfer_request_list.go | 154 + .../metalv1/model_update_email_input.go | 154 + .../services/metalv1/model_user.go | 932 +++++ .../metalv1/model_user_create_input.go | 745 ++++ .../services/metalv1/model_user_limited.go | 320 ++ .../services/metalv1/model_user_list.go | 191 + .../services/metalv1/model_user_lite.go | 503 +++ .../metalv1/model_user_update_input.go | 339 ++ .../services/metalv1/model_userdata.go | 154 + .../services/metalv1/model_verify_email.go | 168 + .../services/metalv1/model_virtual_circuit.go | 146 + .../model_virtual_circuit_create_input.go | 146 + .../metalv1/model_virtual_circuit_list.go | 154 + .../model_virtual_circuit_update_input.go | 146 + .../services/metalv1/model_virtual_network.go | 603 +++ .../model_virtual_network_create_input.go | 309 ++ .../metalv1/model_virtual_network_list.go | 154 + .../model_vlan_fabric_vc_create_input.go | 510 +++ ...bric_vc_create_input_service_token_type.go | 111 + .../model_vlan_fabric_vc_create_input_type.go | 109 + .../metalv1/model_vlan_virtual_circuit.go | 727 ++++ .../model_vlan_virtual_circuit_bill_type.go | 111 + ...model_vlan_virtual_circuit_create_input.go | 391 ++ .../model_vlan_virtual_circuit_status.go | 131 + .../model_vlan_virtual_circuit_type.go | 109 + ...model_vlan_virtual_circuit_update_input.go | 304 ++ .../services/metalv1/model_vrf.go | 759 ++++ .../metalv1/model_vrf_create_input.go | 460 +++ .../model_vrf_fabric_vc_create_input.go | 502 +++ .../metalv1/model_vrf_ip_reservation.go | 1011 +++++ .../model_vrf_ip_reservation_create_input.go | 369 ++ .../metalv1/model_vrf_ip_reservation_list.go | 154 + .../metalv1/model_vrf_ip_reservation_type.go | 109 + .../services/metalv1/model_vrf_list.go | 154 + .../metalv1/model_vrf_metal_gateway.go | 488 +++ .../model_vrf_metal_gateway_create_input.go | 198 + .../services/metalv1/model_vrf_route.go | 565 +++ .../metalv1/model_vrf_route_create_input.go | 235 ++ .../services/metalv1/model_vrf_route_list.go | 191 + .../metalv1/model_vrf_route_status.go | 115 + .../services/metalv1/model_vrf_route_type.go | 109 + .../metalv1/model_vrf_route_update_input.go | 230 ++ .../metalv1/model_vrf_update_input.go | 418 ++ .../metalv1/model_vrf_virtual_circuit.go | 803 ++++ .../model_vrf_virtual_circuit_create_input.go | 560 +++ .../model_vrf_virtual_circuit_status.go | 131 + .../model_vrf_virtual_circuit_update_input.go | 456 +++ .../services/metalv1/response.go | 48 + .../equinix-sdk-go/services/metalv1/utils.go | 348 ++ .../packethost/packngo/CHANGELOG.md | 12 - .../packethost/packngo/CONTRIBUTING.md | 119 - vendor/github.com/packethost/packngo/DCO | 37 - .../github.com/packethost/packngo/LICENSE.txt | 56 - vendor/github.com/packethost/packngo/Makefile | 24 - .../github.com/packethost/packngo/OWNERS.md | 26 - .../github.com/packethost/packngo/README.md | 136 - .../github.com/packethost/packngo/RELEASE.md | 49 - .../github.com/packethost/packngo/SUPPORT.md | 17 - .../packethost/packngo/api_call_options.go | 180 - .../github.com/packethost/packngo/apikeys.go | 176 - .../github.com/packethost/packngo/batches.go | 101 - .../packethost/packngo/bgp_configs.go | 85 - .../packethost/packngo/bgp_sessions.go | 99 - .../packethost/packngo/billing_address.go | 7 - .../packethost/packngo/capacities.go | 103 - .../packethost/packngo/code-of-conduct.md | 3 - .../packethost/packngo/connections.go | 218 - .../packethost/packngo/device_ports.go | 323 -- .../github.com/packethost/packngo/devices.go | 501 --- vendor/github.com/packethost/packngo/doc.go | 3 - vendor/github.com/packethost/packngo/email.go | 89 - .../github.com/packethost/packngo/events.go | 81 - .../packethost/packngo/facilities.go | 54 - .../packngo/hardware_reservations.go | 94 - vendor/github.com/packethost/packngo/ip.go | 245 -- .../github.com/packethost/packngo/metros.go | 41 - .../packethost/packngo/notifications.go | 94 - .../packethost/packngo/operatingsystems.go | 42 - .../packethost/packngo/organizations.go | 168 - .../github.com/packethost/packngo/packngo.go | 386 -- .../packethost/packngo/payment_methods.go | 71 - vendor/github.com/packethost/packngo/plans.go | 143 - vendor/github.com/packethost/packngo/ports.go | 208 - .../github.com/packethost/packngo/projects.go | 182 - vendor/github.com/packethost/packngo/rate.go | 12 - .../packethost/packngo/spotmarket.go | 39 - .../packethost/packngo/spotmarketrequest.go | 118 - .../github.com/packethost/packngo/sshkeys.go | 143 - .../packethost/packngo/timestamp.go | 35 - .../packethost/packngo/two_factor_auth.go | 56 - vendor/github.com/packethost/packngo/user.go | 101 - vendor/github.com/packethost/packngo/utils.go | 156 - .../github.com/packethost/packngo/version.go | 4 - .../packethost/packngo/virtualcircuits.go | 88 - .../packethost/packngo/virtualnetworks.go | 108 - .../github.com/packethost/packngo/volumes.go | 231 -- vendor/github.com/packethost/packngo/vpn.go | 74 - vendor/modules.txt | 6 +- 405 files changed, 125522 insertions(+), 5504 deletions(-) create mode 100644 vendor/github.com/equinix/equinix-sdk-go/LICENSE rename vendor/github.com/{packethost/packngo => equinix/equinix-sdk-go/services/metalv1}/.gitignore (84%) create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/.openapi-generator-ignore create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/README.md create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_authentication.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_batches.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_bgp.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_capacity.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_console_log_details.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_devices.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_emails.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_events.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_facilities.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_firmware_sets.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_hardware_reservations.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_incidents.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_interconnections.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_invitations.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_invoices.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ip_addresses.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_licenses.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_memberships.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_metal_gateways.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_metros.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_operating_systems.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_organizations.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_otps.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_password_reset_tokens.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_payment_methods.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_plans.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ports.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_projects.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_self_service_reservations.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_spot_market.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ssh_keys.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_support_request.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_transfer_requests.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_two_factor_auth.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_usages.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_user_verification_tokens.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_userdata.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_users.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_vlans.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_vrfs.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/client.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/configuration.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_activate_hardware_reservation_request.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_address.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_attribute.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_attribute_data.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_project.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_user.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_batch.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_batches_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_deployment_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_request_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_request_input_deployment_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_status.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_state.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_neighbor_data.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_route.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_address_family.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_input_address_family.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_neighbors.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bond_port_data.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_facility_info.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_facility_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_metro_info.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_metro_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_level_per_baremetal.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_component.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_coordinates.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_device_request.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_email_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_metal_gateway_request.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_organization_interconnection_request.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period_count.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period_unit.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input_mode.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_action_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_action_input_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_actions_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_in_facility_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_in_metro_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_input_billing_cycle.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_created_by.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_health_rollup.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_health_rollup_health_rollup.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_metro.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_project_lite.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_state.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_usage.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_usage_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_disk.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_email.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_email_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_entitlement.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_error.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_event.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_event_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_role.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_service_token_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_state.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_features_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_filesystem.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_facilities_include_parameter_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_address_by_id_200_response.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_availabilities_cidr_parameter.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_reservations_types_parameter_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_metal_gateway_by_id_200_response.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_organization_devices_categories_parameter_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_organizations_personal_parameter.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_plans_type_parameter.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_project_hardware_reservations_provisionable_parameter.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_project_hardware_reservations_state_parameter.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_bucket_parameter.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_direction_parameter.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_interval_parameter.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_timeframe_parameter.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set_list_response.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set_response.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_global_bgp_range.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_global_bgp_range_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_hardware_reservation.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_hardware_reservation_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_href.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_instances_batch_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_instances_batch_create_input_batches_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_mode.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_role.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_status.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_redundancy.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_roles_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invoice.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invoice_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_address.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_address_address_family.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_metro.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_state.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_availabilities_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_facility.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_list_ip_addresses_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_metro.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_request_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_line_item.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_meta.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network_network.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network_network_bonding.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_elastic_ip_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_list_metal_gateways_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_lite.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_state.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_mount.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_move_hardware_reservation_request.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_new_password.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_operating_system.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_operating_system_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_otp_seed.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_parent_block.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_partition.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_billing_address.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_inner_price.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_metros_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_deployment_types_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_cpus_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_drives_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_drives_inner_category.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_features.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_memory.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_nics_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_assign_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_convert_layer3_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_convert_layer3_input_request_ips_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_data.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_network_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_create_input_vlan_assignments_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_state.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_vlan_assignments_inner.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_vlan_assignments_inner_state.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_state.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_from_root_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_from_root_input_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_id_name.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_usage.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_usage_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_raid.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_recovery_code_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_request_ip_reservation_201_response.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_request_ip_reservation_request.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_item_request.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_item_response.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_response.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_server_info.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_per_metro_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_per_metro_report.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_create_input_instance_parameters.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_metro.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_datapoints.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_history_report.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_baremetal.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_facility.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_new_facility.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_report.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_storage.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_support_request_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_support_request_input_priority.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_update_email_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_limited.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_lite.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_userdata.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_verify_email.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input_service_token_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_bill_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_status.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_fabric_vc_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_metal_gateway.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_metal_gateway_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_list.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_status.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_type.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_create_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_status.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_update_input.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/response.go create mode 100644 vendor/github.com/equinix/equinix-sdk-go/services/metalv1/utils.go delete mode 100644 vendor/github.com/packethost/packngo/CHANGELOG.md delete mode 100644 vendor/github.com/packethost/packngo/CONTRIBUTING.md delete mode 100644 vendor/github.com/packethost/packngo/DCO delete mode 100644 vendor/github.com/packethost/packngo/LICENSE.txt delete mode 100644 vendor/github.com/packethost/packngo/Makefile delete mode 100644 vendor/github.com/packethost/packngo/OWNERS.md delete mode 100644 vendor/github.com/packethost/packngo/README.md delete mode 100644 vendor/github.com/packethost/packngo/RELEASE.md delete mode 100644 vendor/github.com/packethost/packngo/SUPPORT.md delete mode 100644 vendor/github.com/packethost/packngo/api_call_options.go delete mode 100644 vendor/github.com/packethost/packngo/apikeys.go delete mode 100644 vendor/github.com/packethost/packngo/batches.go delete mode 100644 vendor/github.com/packethost/packngo/bgp_configs.go delete mode 100644 vendor/github.com/packethost/packngo/bgp_sessions.go delete mode 100644 vendor/github.com/packethost/packngo/billing_address.go delete mode 100644 vendor/github.com/packethost/packngo/capacities.go delete mode 100644 vendor/github.com/packethost/packngo/code-of-conduct.md delete mode 100644 vendor/github.com/packethost/packngo/connections.go delete mode 100644 vendor/github.com/packethost/packngo/device_ports.go delete mode 100644 vendor/github.com/packethost/packngo/devices.go delete mode 100644 vendor/github.com/packethost/packngo/doc.go delete mode 100644 vendor/github.com/packethost/packngo/email.go delete mode 100644 vendor/github.com/packethost/packngo/events.go delete mode 100644 vendor/github.com/packethost/packngo/facilities.go delete mode 100644 vendor/github.com/packethost/packngo/hardware_reservations.go delete mode 100644 vendor/github.com/packethost/packngo/ip.go delete mode 100644 vendor/github.com/packethost/packngo/metros.go delete mode 100644 vendor/github.com/packethost/packngo/notifications.go delete mode 100644 vendor/github.com/packethost/packngo/operatingsystems.go delete mode 100644 vendor/github.com/packethost/packngo/organizations.go delete mode 100644 vendor/github.com/packethost/packngo/packngo.go delete mode 100644 vendor/github.com/packethost/packngo/payment_methods.go delete mode 100644 vendor/github.com/packethost/packngo/plans.go delete mode 100644 vendor/github.com/packethost/packngo/ports.go delete mode 100644 vendor/github.com/packethost/packngo/projects.go delete mode 100644 vendor/github.com/packethost/packngo/rate.go delete mode 100644 vendor/github.com/packethost/packngo/spotmarket.go delete mode 100644 vendor/github.com/packethost/packngo/spotmarketrequest.go delete mode 100644 vendor/github.com/packethost/packngo/sshkeys.go delete mode 100644 vendor/github.com/packethost/packngo/timestamp.go delete mode 100644 vendor/github.com/packethost/packngo/two_factor_auth.go delete mode 100644 vendor/github.com/packethost/packngo/user.go delete mode 100644 vendor/github.com/packethost/packngo/utils.go delete mode 100644 vendor/github.com/packethost/packngo/version.go delete mode 100644 vendor/github.com/packethost/packngo/virtualcircuits.go delete mode 100644 vendor/github.com/packethost/packngo/virtualnetworks.go delete mode 100644 vendor/github.com/packethost/packngo/volumes.go delete mode 100644 vendor/github.com/packethost/packngo/vpn.go diff --git a/go.mod b/go.mod index 638e6299..ea356d52 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,10 @@ module github.com/gardener/machine-controller-manager-provider-equinix-metal go 1.20 require ( + github.com/equinix/equinix-sdk-go v0.33.0 github.com/gardener/machine-controller-manager v0.49.1 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.23.0 - github.com/packethost/packngo v0.9.0 github.com/spf13/pflag v1.0.5 golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 k8s.io/api v0.26.2 diff --git a/go.sum b/go.sum index b46d80dc..2d75632a 100644 --- a/go.sum +++ b/go.sum @@ -60,8 +60,6 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.0.1 h1:r8L/HqC0Hje5AXMu1ooW8oyQyOFv4GxqpL0nRP7SLLY= -github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= @@ -69,6 +67,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/equinix/equinix-sdk-go v0.33.0 h1:AmRUWJ1bdZwaNm7/yOcD4TLOWGhbHLSk6SB2fE7lchM= +github.com/equinix/equinix-sdk-go v0.33.0/go.mod h1:qnpdRzVftHFNaJFk1VSIrAOTLrIoeDrxzUr3l8ARyvQ= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -230,8 +230,6 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys= github.com/onsi/gomega v1.23.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= -github.com/packethost/packngo v0.9.0 h1:dcrJFDNdbW+xCCNzWCmtol1x+hanEZmff5Myv/ku82U= -github.com/packethost/packngo v0.9.0/go.mod h1:YrtUNN9IRjjqN6zK+cy2IYoi3EjHfoWTWxJkI1I1Vk0= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -281,7 +279,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -296,9 +294,7 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200420201142-3c4aac89819a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= diff --git a/pkg/mock/equinixmetal.go b/pkg/mock/equinixmetal.go index bd7da214..3e6c88c7 100644 --- a/pkg/mock/equinixmetal.go +++ b/pkg/mock/equinixmetal.go @@ -1,39 +1,40 @@ package mock import ( + "context" + "errors" "fmt" "net/http" "strings" "sync" "time" + "github.com/equinix/equinix-sdk-go/services/metalv1" "github.com/gardener/machine-controller-manager-provider-equinix-metal/pkg/spi" - "github.com/gardener/machine-controller-manager/pkg/util/provider/machinecodes/codes" - "github.com/gardener/machine-controller-manager/pkg/util/provider/machinecodes/status" - "github.com/packethost/packngo" corev1 "k8s.io/api/core/v1" ) // PluginSPIImpl is the plugin SPI implementation to mock the provider type PluginSPIImpl struct { - Devices []packngo.Device + Devices []metalv1.Device index int mu sync.Mutex // so that we can increment index without conflicts } // NewSession creates a mock session for provider -func (p *PluginSPIImpl) NewSession(secret *corev1.Secret) packngo.DeviceService { +func (p *PluginSPIImpl) NewSession(secret *corev1.Secret) (spi.MetalDeviceService, error) { apiKey := spi.GetAPIKey(secret) token := strings.TrimSpace(apiKey) - if token != "" { - return &deviceService{ - spi: p, - name: "gardener", - token: token, - } + if token == "" { + return nil, errors.New("Equinix Metal api token required") } - return nil + + return &deviceService{ + spi: p, + name: "gardener", + token: token, + }, nil } func (p *PluginSPIImpl) increment() { @@ -42,7 +43,7 @@ func (p *PluginSPIImpl) increment() { p.index++ } -func (p *PluginSPIImpl) addDevice(dev packngo.Device) { +func (p *PluginSPIImpl) addDevice(dev metalv1.Device) { p.mu.Lock() defer p.mu.Unlock() p.Devices = append(p.Devices, dev) @@ -54,86 +55,76 @@ type deviceService struct { token string } -func (d *deviceService) List(projectID string, opts *packngo.ListOptions) ([]packngo.Device, *packngo.Response, error) { - return d.spi.Devices, &packngo.Response{}, nil +func (d *deviceService) FindProjectDevices( + ctx context.Context, + projectID string, +) (*metalv1.DeviceList, *http.Response, error) { + return &metalv1.DeviceList{ + Devices: d.spi.Devices, + }, &http.Response{}, nil } -func (d *deviceService) Get(deviceID string, opts *packngo.GetOptions) (*packngo.Device, *packngo.Response, error) { + +func (d *deviceService) FindDeviceByID( + ctx context.Context, + deviceID string, +) (*metalv1.Device, *http.Response, error) { for _, dev := range d.spi.Devices { - if dev.ID == deviceID { - return &dev, &packngo.Response{}, nil + if *dev.Id == deviceID { + return &dev, &http.Response{}, nil } } - return nil, &packngo.Response{ - Response: &http.Response{ - StatusCode: 404, - Status: "404 NOT FOUND", - }, + return nil, &http.Response{ + StatusCode: 404, + Status: "404 NOT FOUND", }, fmt.Errorf("404 NOT FOUND") } -func (d *deviceService) Create(req *packngo.DeviceCreateRequest) (*packngo.Device, *packngo.Response, error) { + +func (d *deviceService) CreateDevice( + ctx context.Context, + projectID string, + createDeviceRequest metalv1.CreateDeviceRequest, +) (*metalv1.Device, *http.Response, error) { now := time.Now() d.spi.increment() - dev := packngo.Device{ - ID: fmt.Sprintf("%06d", d.spi.index), + req := createDeviceRequest.DeviceCreateInMetroInput + var ( + name = fmt.Sprintf("%06d", d.spi.index) + billingCycle = string(*req.BillingCycle) + ) + dev := metalv1.Device{ + Id: &name, Hostname: req.Hostname, - Description: &req.Description, - Created: now.String(), - Updated: now.String(), - BillingCycle: req.BillingCycle, + Description: req.Description, + CreatedAt: &now, + UpdatedAt: &now, + BillingCycle: &billingCycle, Tags: req.Tags, - OS: &packngo.OS{ - Name: req.OS, + OperatingSystem: &metalv1.OperatingSystem{ + Name: &req.OperatingSystem, }, - Plan: &packngo.Plan{}, - Facility: &packngo.Facility{ - Code: req.Facility[0], + Plan: &metalv1.Plan{}, + Metro: &metalv1.DeviceMetro{ + Code: &req.Metro, }, - Project: &packngo.Project{ - ID: req.ProjectID, + Project: &metalv1.Project{ + Id: &projectID, }, - UserData: req.UserData, + Userdata: req.Userdata, } d.spi.addDevice(dev) - return &dev, &packngo.Response{}, nil + return &dev, &http.Response{}, nil } -func (d *deviceService) Delete(deviceID string, force bool) (*packngo.Response, error) { - var devs []packngo.Device + +func (d *deviceService) DeleteDevice( + ctx context.Context, + deviceID string, +) (*http.Response, error) { + var devs []metalv1.Device for _, dev := range d.spi.Devices { - if dev.ID != deviceID { + if *dev.Id != deviceID { devs = append(devs, dev) } } d.spi.Devices = devs - return &packngo.Response{}, nil -} - -/* - Below are not implemenetd as unnecessary for MCM -*/ -func (d *deviceService) Update(string, *packngo.DeviceUpdateRequest) (*packngo.Device, *packngo.Response, error) { - return nil, nil, status.Error(codes.Unimplemented, "Update unsupported in mock") -} -func (d *deviceService) Reboot(string) (*packngo.Response, error) { - return nil, status.Error(codes.Unimplemented, "Reboot unsupported in mock") -} -func (d *deviceService) PowerOff(string) (*packngo.Response, error) { - return nil, status.Error(codes.Unimplemented, "PowerOff unsupported in mock") -} -func (d *deviceService) PowerOn(string) (*packngo.Response, error) { - return nil, status.Error(codes.Unimplemented, "PowerOn unsupported in mock") -} -func (d *deviceService) Lock(string) (*packngo.Response, error) { - return nil, status.Error(codes.Unimplemented, "Lock unsupported in mock") -} -func (d *deviceService) Unlock(string) (*packngo.Response, error) { - return nil, status.Error(codes.Unimplemented, "Unlock unsupported in mock") -} -func (d *deviceService) ListBGPSessions(deviceID string, opts *packngo.ListOptions) ([]packngo.BGPSession, *packngo.Response, error) { - return nil, nil, status.Error(codes.Unimplemented, "ListBGPSessions unsupported in mock") -} -func (d *deviceService) ListBGPNeighbors(deviceID string, opts *packngo.ListOptions) ([]packngo.BGPNeighbor, *packngo.Response, error) { - return nil, nil, status.Error(codes.Unimplemented, "ListBGPNeighbors unsupported in mock") -} -func (d *deviceService) ListEvents(deviceID string, opts *packngo.ListOptions) ([]packngo.Event, *packngo.Response, error) { - return nil, nil, status.Error(codes.Unimplemented, "ListEvents unsupported in mock") + return &http.Response{}, nil } diff --git a/pkg/provider/apis/provider_spec.go b/pkg/provider/apis/provider_spec.go index 30ae3e8b..ceec41a6 100644 --- a/pkg/provider/apis/provider_spec.go +++ b/pkg/provider/apis/provider_spec.go @@ -27,11 +27,10 @@ const ( type EquinixMetalProviderSpec struct { APIVersion string `json:"apiVersion,omitempty"` Metro string `json:"metro,omitempty"` - Facilities []string `json:"facilities"` MachineType string `json:"machineType"` BillingCycle string `json:"billingCycle"` OS string `json:"OS,omitempty"` - IPXEScriptURL string `json:"ipxeScriptUrl,omitempty"` + IPXEScriptURL *string `json:"ipxeScriptUrl,omitempty"` ProjectID string `json:"projectID"` Tags []string `json:"tags,omitempty"` SSHKeys []string `json:"sshKeys,omitempty"` diff --git a/pkg/provider/apis/validation/validation.go b/pkg/provider/apis/validation/validation.go index eea77b17..1cdd5b03 100644 --- a/pkg/provider/apis/validation/validation.go +++ b/pkg/provider/apis/validation/validation.go @@ -49,7 +49,7 @@ func ValidateProviderSpec(spec *api.EquinixMetalProviderSpec, fldPath *field.Pat allErrs = field.ErrorList{} ) - if "" == spec.OS && "" == spec.IPXEScriptURL { + if "" == spec.OS && nil == spec.IPXEScriptURL { allErrs = append(allErrs, field.Required(fldPath.Child("os"), "OS or IPXEScriptURL is required")) } if "" == spec.MachineType { diff --git a/pkg/provider/core.go b/pkg/provider/core.go index 3073faa0..cdc2c139 100644 --- a/pkg/provider/core.go +++ b/pkg/provider/core.go @@ -23,16 +23,18 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" + "net/http" "strings" + "github.com/equinix/equinix-sdk-go/services/metalv1" api "github.com/gardener/machine-controller-manager-provider-equinix-metal/pkg/provider/apis" validation "github.com/gardener/machine-controller-manager-provider-equinix-metal/pkg/provider/apis/validation" + "github.com/gardener/machine-controller-manager-provider-equinix-metal/pkg/spi" "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1" "github.com/gardener/machine-controller-manager/pkg/util/provider/driver" "github.com/gardener/machine-controller-manager/pkg/util/provider/machinecodes/codes" "github.com/gardener/machine-controller-manager/pkg/util/provider/machinecodes/status" - "github.com/packethost/packngo" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/klog/v2" @@ -64,24 +66,28 @@ const ( // // RESPONSE PARAMETERS (driver.CreateMachineResponse) // ProviderID string Unique identification of the VM at the cloud provider. This could be the same/different from req.MachineName. -// ProviderID typically matches with the node.Spec.ProviderID on the node object. -// Eg: gce://project-name/region/vm-ProviderID +// +// ProviderID typically matches with the node.Spec.ProviderID on the node object. +// Eg: gce://project-name/region/vm-ProviderID +// // NodeName string Returns the name of the node-object that the VM register's with Kubernetes. -// This could be different from req.MachineName as well +// +// This could be different from req.MachineName as well +// // LastKnownState string (Optional) Last known state of VM during the current operation. -// Could be helpful to continue operations in future requests. +// +// Could be helpful to continue operations in future requests. // // OPTIONAL IMPLEMENTATION LOGIC // It is optionally expected by the safety controller to use an identification mechanisms to map the VM Created by a providerSpec. // These could be done using tag(s)/resource-groups etc. // This logic is used by safety controller to delete orphan VMs which are not backed by any machine CRD -// func (p *Provider) CreateMachine(ctx context.Context, req *driver.CreateMachineRequest) (*driver.CreateMachineResponse, error) { // Log messages to track request klog.V(2).Infof("Machine creation request has been received for %q", req.Machine.Name) var ( - userData []byte + userData string machine = req.Machine secret = req.Secret machineClass = req.MachineClass @@ -111,29 +117,40 @@ func (p *Provider) CreateMachine(ctx context.Context, req *driver.CreateMachineR return nil, status.Error(codes.InvalidArgument, strings.Join(msgs, "; ")) } - svc := p.createSVC(req.Secret) - if svc == nil { - return nil, status.Error(codes.Internal, "nil Equinix Metal service returned") + billingCycle, err := metalv1.NewDeviceCreateInputBillingCycleFromValue(providerSpec.BillingCycle) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + svc, err := p.createSVC(req.Secret) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) } // we already validated the existence and non-nil-ness of userData in the validation - userData = secret.Data["userData"] + userData = string(secret.Data["userData"]) // packet tags are strings only - createRequest := &packngo.DeviceCreateRequest{ - Hostname: machine.Name, - UserData: string(userData), - Plan: providerSpec.MachineType, - ProjectID: providerSpec.ProjectID, - BillingCycle: providerSpec.BillingCycle, - Metro: providerSpec.Metro, - Facility: providerSpec.Facilities, - OS: providerSpec.OS, - IPXEScriptURL: providerSpec.IPXEScriptURL, - ProjectSSHKeys: providerSpec.SSHKeys, - Tags: providerSpec.Tags, + createRequest := metalv1.CreateDeviceRequest{ + DeviceCreateInMetroInput: &metalv1.DeviceCreateInMetroInput{ + Metro: providerSpec.Metro, + Hostname: &machine.Name, + Userdata: &userData, + Plan: providerSpec.MachineType, + BillingCycle: billingCycle, + OperatingSystem: providerSpec.OS, + IpxeScriptUrl: providerSpec.IPXEScriptURL, + ProjectSshKeys: providerSpec.SSHKeys, + Tags: providerSpec.Tags, + }, } klog.V(3).Infof("will create machine with request %#v, reservation IDs %v, reservedOnly %v", createRequest, providerSpec.ReservationIDs, providerSpec.ReservedOnly) - device, err := createDeviceWithReservations(svc, createRequest, providerSpec.ReservationIDs, providerSpec.ReservedOnly) + device, err := createDeviceWithReservations( + ctx, + svc, + providerSpec.ProjectID, + createRequest, + providerSpec.ReservationIDs, + providerSpec.ReservedOnly) if err != nil { klog.Errorf("Could not create machine: %v", err) return nil, status.Error(codes.Unavailable, fmt.Sprintf("Could not create machine: %v", err)) @@ -157,15 +174,17 @@ func (p *Provider) CreateMachine(ctx context.Context, req *driver.CreateMachineR // // RESPONSE PARAMETERS (driver.DeleteMachineResponse) // LastKnownState bytes(blob) (Optional) Last known state of VM during the current operation. -// Could be helpful to continue operations in future requests. // +// Could be helpful to continue operations in future requests. func (p *Provider) DeleteMachine(ctx context.Context, req *driver.DeleteMachineRequest) (*driver.DeleteMachineResponse, error) { // Log messages to track delete request klog.V(2).Infof("Machine deletion request has been received for %q", req.Machine.Name) // Check if incoming CR is a CR we support if req.MachineClass.Provider != ProviderEquinixMetal { - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("Requested for Provider '%s', we only support '%s'", req.MachineClass.Provider, ProviderEquinixMetal)) + return nil, status.Error( + codes.InvalidArgument, + fmt.Sprintf("Requested for Provider '%s', we only support '%s'", req.MachineClass.Provider, ProviderEquinixMetal)) } // decodes the provider spec, and validates the spec and the secret for required fields. @@ -174,11 +193,11 @@ func (p *Provider) DeleteMachine(ctx context.Context, req *driver.DeleteMachineR } instanceID := decodeMachineID(req.Machine.Spec.ProviderID) - svc := p.createSVC(req.Secret) - if svc == nil { - return nil, status.Error(codes.Internal, "nil Equinix Metal service returned") + svc, err := p.createSVC(req.Secret) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) } - resp, err := svc.Delete(instanceID, true) + resp, err := svc.DeleteDevice(ctx, instanceID) if err != nil { if resp.StatusCode == 404 { // if it is not found, do not error, just return @@ -202,10 +221,13 @@ func (p *Provider) DeleteMachine(ctx context.Context, req *driver.DeleteMachineR // // RESPONSE PARAMETERS (driver.GetMachineStatueResponse) // ProviderID string Unique identification of the VM at the cloud provider. This could be the same/different from req.MachineName. -// ProviderID typically matches with the node.Spec.ProviderID on the node object. -// Eg: gce://project-name/region/vm-ProviderID +// +// ProviderID typically matches with the node.Spec.ProviderID on the node object. +// Eg: gce://project-name/region/vm-ProviderID +// // NodeName string Returns the name of the node-object that the VM register's with Kubernetes. -// This could be different from req.MachineName as well +// +// This could be different from req.MachineName as well // // The request should return a NOT_FOUND (5) status error code if the machine is not existing func (p *Provider) GetMachineStatus(ctx context.Context, req *driver.GetMachineStatusRequest) (*driver.GetMachineStatusResponse, error) { @@ -219,18 +241,20 @@ func (p *Provider) GetMachineStatus(ctx context.Context, req *driver.GetMachineS // Check if incoming CR is a CR we support if req.MachineClass.Provider != ProviderEquinixMetal { - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("Requested for Provider '%s', we only support '%s'", req.MachineClass.Provider, ProviderEquinixMetal)) + return nil, status.Error( + codes.InvalidArgument, + fmt.Sprintf("Requested for Provider '%s', we only support '%s'", req.MachineClass.Provider, ProviderEquinixMetal)) } if err := validateSecretAPIKey(req.Secret); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - svc := p.createSVC(req.Secret) - if svc == nil { - return nil, status.Error(codes.Internal, "nil Equinix Metal service returned") + svc, err := p.createSVC(req.Secret) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) } - device, _, err := svc.Get(id, &packngo.GetOptions{}) + device, _, err := svc.FindDeviceByID(ctx, id) if err != nil { return nil, status.Error(codes.NotFound, fmt.Sprintf("Could not get device %s: %v", id, err)) } @@ -253,8 +277,8 @@ func (p *Provider) GetMachineStatus(ctx context.Context, req *driver.GetMachineS // // RESPONSE PARAMETERS (driver.ListMachinesResponse) // MachineList map A map containing the keys as the MachineID and value as the MachineName -// for all machine's who where possibilly created by this ProviderSpec // +// for all machine's who where possibilly created by this ProviderSpec func (p *Provider) ListMachines(ctx context.Context, req *driver.ListMachinesRequest) (*driver.ListMachinesResponse, error) { // Log messages to track start and end of request klog.V(2).Infof("List machines request has been received for %q", req.MachineClass.Name) @@ -291,17 +315,17 @@ func (p *Provider) ListMachines(ctx context.Context, req *driver.ListMachinesReq return resp, nil } - svc := p.createSVC(req.Secret) - if svc == nil { - return nil, status.Error(codes.Internal, "nil Equinix Metal service returned") + svc, err := p.createSVC(req.Secret) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) } - devices, _, err := svc.List(providerSpec.ProjectID, &packngo.ListOptions{}) + deviceList, _, err := svc.FindProjectDevices(ctx, providerSpec.ProjectID) if err != nil { msg := fmt.Sprintf("Could not list devices for project %s: %v", providerSpec.ProjectID, err) klog.Error(msg) return nil, status.Error(codes.Unknown, msg) } - for _, d := range devices { + for _, d := range deviceList.Devices { matchedCluster := false matchedRole := false for _, tag := range d.Tags { @@ -313,7 +337,7 @@ func (p *Provider) ListMachines(ctx context.Context, req *driver.ListMachinesReq } } if matchedCluster && matchedRole { - resp.MachineList[encodeMachineID(&d)] = d.Hostname + resp.MachineList[encodeMachineID(&d)] = *d.Hostname } } return resp, nil @@ -326,7 +350,6 @@ func (p *Provider) ListMachines(ctx context.Context, req *driver.ListMachinesReq // // RESPONSE PARAMETERS (driver.GetVolumeIDsResponse) // VolumeIDs []string VolumeIDs is a repeated list of VolumeIDs. -// func (p *Provider) GetVolumeIDs(ctx context.Context, req *driver.GetVolumeIDsRequest) (*driver.GetVolumeIDsResponse, error) { // Log messages to track start and end of request klog.V(2).Infof("GetVolumeIDs request has been received for %q", req.PVSpecs) @@ -335,8 +358,8 @@ func (p *Provider) GetVolumeIDs(ctx context.Context, req *driver.GetVolumeIDsReq return &driver.GetVolumeIDsResponse{}, status.Error(codes.Unimplemented, "Equinix Metal does not have storage") } -// create a session -func (p *Provider) createSVC(secret *corev1.Secret) packngo.DeviceService { +// create a session +func (p *Provider) createSVC(secret *corev1.Secret) (spi.MetalDeviceService, error) { return p.SPI.NewSession(secret) } @@ -364,33 +387,40 @@ func decodeProviderSpec(machineClass *v1alpha1.MachineClass) (*api.EquinixMetalP return nil, status.Error(codes.Internal, err.Error()) } - if providerSpec.IPXEScriptURL != "" { + if providerSpec.IPXEScriptURL != nil { providerSpec.OS = "custom_ipxe" } return providerSpec, nil } -func createDeviceWithReservations(svc packngo.DeviceService, createRequest *packngo.DeviceCreateRequest, reservationIDs []string, reservedOnly bool) (device *packngo.Device, err error) { +func createDeviceWithReservations( + ctx context.Context, + svc spi.MetalDeviceService, + projectID string, + createRequest metalv1.CreateDeviceRequest, + reservationIDs []string, + reservedOnly bool, +) (device *metalv1.Device, err error) { // if there were no reservation IDs and I didn't ask for reservedOnly, then just create one on-demand and return if len(reservationIDs) == 0 && !reservedOnly { klog.V(2).Info("No reservation ids provided, creating a on demand instance") - device, _, err = svc.Create(createRequest) + device, _, err = svc.CreateDevice(ctx, projectID, createRequest) return device, err } // if we got here, we either had some reservation IDs, or we were asked to do reserved only. // In both cases, we try reservations first. for _, resID := range reservationIDs { - createRequest.HardwareReservationID = resID - var res *packngo.Response - device, res, err = svc.Create(createRequest) + createRequest.DeviceCreateInMetroInput.HardwareReservationId = &resID + var res *http.Response + device, res, err = svc.CreateDevice(ctx, projectID, createRequest) // if no error, we got the device, return it if err == nil { return device, err } body := bytes.NewBuffer([]byte{}) - if _, err := ioutil.ReadAll(res.Request.Body); err != nil { + if _, err := io.ReadAll(res.Request.Body); err != nil { klog.Error(err) } klog.Errorf("Error while creating machine with reservation id %s: Request: %s Error: %v", resID, body.String(), err) @@ -400,7 +430,7 @@ func createDeviceWithReservations(svc packngo.DeviceService, createRequest *pack return nil, errors.New("could not get a device with the provided reservation IDs, and reservedOnly is true") } // now just create a device on demand - device, _, err = svc.Create(createRequest) + device, _, err = svc.CreateDevice(ctx, projectID, createRequest) return device, err } @@ -418,8 +448,8 @@ func validateSecret(secret *corev1.Secret, fields ...string) error { return nil } -func encodeMachineID(device *packngo.Device) string { - return fmt.Sprintf("equinixmetal://%s/%s", device.Facility.Code, device.ID) +func encodeMachineID(device *metalv1.Device) string { + return fmt.Sprintf("equinixmetal://%s/%s", *device.Metro.Code, *device.Id) } func decodeMachineID(id string) string { diff --git a/pkg/provider/core_test.go b/pkg/provider/core_test.go index 2db7aa4a..dc07e30d 100644 --- a/pkg/provider/core_test.go +++ b/pkg/provider/core_test.go @@ -26,7 +26,6 @@ const ( var _ = Describe("MachineServer", func() { // Some initializations providerSpecStruct := api.EquinixMetalProviderSpec{ - Facilities: []string{"ewr1", "ny5"}, Metro: "ny", MachineType: "c3.small.x86", BillingCycle: "hourly", @@ -86,7 +85,7 @@ var _ = Describe("MachineServer", func() { }, expect: expect{ machineResponse: &driver.CreateMachineResponse{ - ProviderID: "equinixmetal://ewr1/000001", + ProviderID: "equinixmetal://ny/000001", NodeName: "machine-0", }, errToHaveOccurred: false, diff --git a/pkg/spi/equinixmetal.go b/pkg/spi/equinixmetal.go index 2e0c8c21..be95d6fc 100644 --- a/pkg/spi/equinixmetal.go +++ b/pkg/spi/equinixmetal.go @@ -1,10 +1,13 @@ package spi import ( + "context" + "errors" + "net/http" "strings" + "github.com/equinix/equinix-sdk-go/services/metalv1" api "github.com/gardener/machine-controller-manager-provider-equinix-metal/pkg/provider/apis" - "github.com/packethost/packngo" corev1 "k8s.io/api/core/v1" ) @@ -13,18 +16,20 @@ type PluginSPIImpl struct { } // NewSession creates a session for equinix metal provider -func (p *PluginSPIImpl) NewSession(secret *corev1.Secret) packngo.DeviceService { +func (p *PluginSPIImpl) NewSession(secret *corev1.Secret) (MetalDeviceService, error) { apiKey := GetAPIKey(secret) token := strings.TrimSpace(apiKey) - if token != "" { - client := packngo.NewClientWithAuth("gardener", token, nil) - if client == nil { - return nil - } - return client.Devices + if token == "" { + return nil, errors.New("Equinix Metal api token required") } - return nil + + configuration := metalv1.NewConfiguration() + configuration.Debug = true + configuration.AddDefaultHeader("X-Auth-Token", token) + client := metalv1.NewAPIClient(configuration) + + return &metalDeviceSvc{client: client}, nil } // GetAPIKey extracts the APIKey from the *corev1.Secret object @@ -42,3 +47,38 @@ func extractCredentialsFromData(data map[string][]byte, keys ...string) string { } return "" } + +type metalDeviceSvc struct { + client *metalv1.APIClient +} + +func (a *metalDeviceSvc) FindProjectDevices( + ctx context.Context, + projectID string, +) (*metalv1.DeviceList, *http.Response, error) { + return a.client.DevicesApi.FindProjectDevices(ctx, projectID).Execute() +} + +func (a *metalDeviceSvc) FindDeviceByID( + ctx context.Context, + deviceID string, +) (*metalv1.Device, *http.Response, error) { + return a.client.DevicesApi.FindDeviceById(ctx, deviceID).Execute() +} + +func (a *metalDeviceSvc) CreateDevice( + ctx context.Context, + projectID string, + createDeviceRequest metalv1.CreateDeviceRequest, +) (*metalv1.Device, *http.Response, error) { + return a.client.DevicesApi. + CreateDevice(ctx, projectID). + CreateDeviceRequest(createDeviceRequest).Execute() +} + +func (a *metalDeviceSvc) DeleteDevice( + ctx context.Context, + deviceID string, +) (*http.Response, error) { + return a.client.DevicesApi.DeleteDevice(ctx, deviceID).Execute() +} diff --git a/pkg/spi/spi.go b/pkg/spi/spi.go index e15a46dd..64477795 100644 --- a/pkg/spi/spi.go +++ b/pkg/spi/spi.go @@ -17,12 +17,28 @@ limitations under the License. package spi import ( - "github.com/packethost/packngo" + "context" + "net/http" + + "github.com/equinix/equinix-sdk-go/services/metalv1" corev1 "k8s.io/api/core/v1" ) +// MetalDeviceService is a simple interface for the metalv1 device api. +// It only contains simplified api that is required for the machine controller. +type MetalDeviceService interface { + FindProjectDevices(ctx context.Context, projectID string) (*metalv1.DeviceList, *http.Response, error) + FindDeviceByID(ctx context.Context, deviceID string) (*metalv1.Device, *http.Response, error) + CreateDevice( + ctx context.Context, + projectID string, + createDeviceRequest metalv1.CreateDeviceRequest, + ) (*metalv1.Device, *http.Response, error) + DeleteDevice(ctx context.Context, deviceID string) (*http.Response, error) +} + // SessionProviderInterface provides an interface to deal with cloud provider session // Example interfaces are listed below. type SessionProviderInterface interface { - NewSession(*corev1.Secret) packngo.DeviceService + NewSession(*corev1.Secret) (MetalDeviceService, error) } diff --git a/vendor/github.com/equinix/equinix-sdk-go/LICENSE b/vendor/github.com/equinix/equinix-sdk-go/LICENSE new file mode 100644 index 00000000..c33bfe61 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2022 The metal-go AUTHORS. All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/packethost/packngo/.gitignore b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/.gitignore similarity index 84% rename from vendor/github.com/packethost/packngo/.gitignore rename to vendor/github.com/equinix/equinix-sdk-go/services/metalv1/.gitignore index 7cc2daad..daf913b1 100644 --- a/vendor/github.com/packethost/packngo/.gitignore +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/.gitignore @@ -1,4 +1,3 @@ -### Go template # Compiled Object files, Static and Dynamic libs (Shared Objects) *.o *.a @@ -23,8 +22,3 @@ _testmain.go *.exe *.test *.prof -*.swp - -# IDEs -.idea**/** -.vscode diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/.openapi-generator-ignore b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/.openapi-generator-ignore new file mode 100644 index 00000000..7484ee59 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/README.md b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/README.md new file mode 100644 index 00000000..09b5b6d8 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/README.md @@ -0,0 +1,733 @@ +# Go API client for metalv1 + +# Introduction +Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. + +The API allows you to programmatically interact with all +of your Equinix Metal resources, including devices, networks, addresses, organizations, +projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. + +The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . + +# Common Parameters + +The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. + +## Pagination + +Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. + +The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. + +## Sorting + +Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). + +## Filtering + +Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. + +For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: + +```sh +curl -H 'X-Auth-Token: my_authentication_token' \\ + https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 +``` + +Only IP addresses with the `type` field set to `public_ipv4` will be returned. + +## Searching + +Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. + +To search resources you can use the `search` query parameter. + +## Include and Exclude + +For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. + +```json +{ + ... + \"project\": { + \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" + } +} +``` + +If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. + +For example: + +```sh +curl -H 'X-Auth-Token: my_authentication_token' \\ + https://api.equinix.com/metal/v1/user?include=projects +``` + +The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. + +To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). + +```sh +curl -H 'X-Auth-Token: my_authentication_token' \\ + https://api.equinix.com/metal/v1/user?include=emails,projects,memberships +``` + +You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): + +```sh +curl -H 'X-Auth-Token: my_authentication_token' \\ + https://api.equinix.com/metal/v1/user?include=memberships.projects +``` + +To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: 0.33.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: + +```sh +go get github.com/stretchr/testify/assert +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```go +import metalv1 "github.com/equinix/equinix-sdk-go/services/metalv1" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```go +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `metalv1.ContextServerIndex` of type `int`. + +```go +ctx := context.WithValue(context.Background(), metalv1.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `metalv1.ContextServerVariables` of type `map[string]string`. + +```go +ctx := context.WithValue(context.Background(), metalv1.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `metalv1.ContextOperationServerIndices` and `metalv1.ContextOperationServerVariables` context maps. + +```go +ctx := context.WithValue(context.Background(), metalv1.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), metalv1.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.equinix.com/metal/v1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AuthenticationApi* | [**CreateAPIKey**](docs/AuthenticationApi.md#createapikey) | **Post** /user/api-keys | Create an API key +*AuthenticationApi* | [**CreateProjectAPIKey**](docs/AuthenticationApi.md#createprojectapikey) | **Post** /projects/{id}/api-keys | Create an API key for a project. +*AuthenticationApi* | [**DeleteAPIKey**](docs/AuthenticationApi.md#deleteapikey) | **Delete** /api-keys/{id} | Delete the API key +*AuthenticationApi* | [**DeleteUserAPIKey**](docs/AuthenticationApi.md#deleteuserapikey) | **Delete** /user/api-keys/{id} | Delete the API key +*AuthenticationApi* | [**FindAPIKeys**](docs/AuthenticationApi.md#findapikeys) | **Get** /user/api-keys | Retrieve all user API keys +*AuthenticationApi* | [**FindProjectAPIKeys**](docs/AuthenticationApi.md#findprojectapikeys) | **Get** /projects/{id}/api-keys | Retrieve all API keys for the project. +*BGPApi* | [**DeleteBgpSession**](docs/BGPApi.md#deletebgpsession) | **Delete** /bgp/sessions/{id} | Delete the BGP session +*BGPApi* | [**FindBgpConfigByProject**](docs/BGPApi.md#findbgpconfigbyproject) | **Get** /projects/{id}/bgp-config | Retrieve a bgp config +*BGPApi* | [**FindBgpSessionById**](docs/BGPApi.md#findbgpsessionbyid) | **Get** /bgp/sessions/{id} | Retrieve a BGP session +*BGPApi* | [**FindGlobalBgpRanges**](docs/BGPApi.md#findglobalbgpranges) | **Get** /projects/{id}/global-bgp-ranges | Retrieve all global bgp ranges +*BGPApi* | [**FindProjectBgpSessions**](docs/BGPApi.md#findprojectbgpsessions) | **Get** /projects/{id}/bgp/sessions | Retrieve all BGP sessions for project +*BGPApi* | [**RequestBgpConfig**](docs/BGPApi.md#requestbgpconfig) | **Post** /projects/{id}/bgp-configs | Requesting bgp config +*BGPApi* | [**UpdateBgpSession**](docs/BGPApi.md#updatebgpsession) | **Put** /bgp/sessions/{id} | Update the BGP session +*BatchesApi* | [**CreateDeviceBatch**](docs/BatchesApi.md#createdevicebatch) | **Post** /projects/{id}/devices/batch | Create a devices batch +*BatchesApi* | [**DeleteBatch**](docs/BatchesApi.md#deletebatch) | **Delete** /batches/{id} | Delete the Batch +*BatchesApi* | [**FindBatchById**](docs/BatchesApi.md#findbatchbyid) | **Get** /batches/{id} | Retrieve a Batch +*BatchesApi* | [**FindBatchesByProject**](docs/BatchesApi.md#findbatchesbyproject) | **Get** /projects/{id}/batches | Retrieve all batches by project +*CapacityApi* | [**CheckCapacityForFacility**](docs/CapacityApi.md#checkcapacityforfacility) | **Post** /capacity | Check capacity +*CapacityApi* | [**CheckCapacityForMetro**](docs/CapacityApi.md#checkcapacityformetro) | **Post** /capacity/metros | Check capacity for a metro +*CapacityApi* | [**FindCapacityForFacility**](docs/CapacityApi.md#findcapacityforfacility) | **Get** /capacity | View capacity +*CapacityApi* | [**FindCapacityForMetro**](docs/CapacityApi.md#findcapacityformetro) | **Get** /capacity/metros | View capacity for metros +*CapacityApi* | [**FindOrganizationCapacityPerFacility**](docs/CapacityApi.md#findorganizationcapacityperfacility) | **Get** /organizations/{id}/capacity | View available hardware plans per Facility for given organization +*CapacityApi* | [**FindOrganizationCapacityPerMetro**](docs/CapacityApi.md#findorganizationcapacitypermetro) | **Get** /organizations/{id}/capacity/metros | View available hardware plans per Metro for given organization +*ConsoleLogDetailsApi* | [**CaptureScreenshot**](docs/ConsoleLogDetailsApi.md#capturescreenshot) | **Get** /devices/{id}/diagnostics/screenshot | +*DevicesApi* | [**CreateBgpSession**](docs/DevicesApi.md#createbgpsession) | **Post** /devices/{id}/bgp/sessions | Create a BGP session +*DevicesApi* | [**CreateDevice**](docs/DevicesApi.md#createdevice) | **Post** /projects/{id}/devices | Create a device +*DevicesApi* | [**CreateIPAssignment**](docs/DevicesApi.md#createipassignment) | **Post** /devices/{id}/ips | Create an ip assignment +*DevicesApi* | [**DeleteDevice**](docs/DevicesApi.md#deletedevice) | **Delete** /devices/{id} | Delete the device +*DevicesApi* | [**FindBgpSessions**](docs/DevicesApi.md#findbgpsessions) | **Get** /devices/{id}/bgp/sessions | Retrieve all BGP sessions +*DevicesApi* | [**FindDeviceById**](docs/DevicesApi.md#finddevicebyid) | **Get** /devices/{id} | Retrieve a device +*DevicesApi* | [**FindDeviceCustomdata**](docs/DevicesApi.md#finddevicecustomdata) | **Get** /devices/{id}/customdata | Retrieve the custom metadata of an instance +*DevicesApi* | [**FindDeviceMetadataByID**](docs/DevicesApi.md#finddevicemetadatabyid) | **Get** /devices/{id}/metadata | Retrieve metadata +*DevicesApi* | [**FindDeviceUserdataByID**](docs/DevicesApi.md#finddeviceuserdatabyid) | **Get** /devices/{id}/userdata | Retrieve userdata +*DevicesApi* | [**FindIPAssignmentCustomdata**](docs/DevicesApi.md#findipassignmentcustomdata) | **Get** /devices/{instance_id}/ips/{id}/customdata | Retrieve the custom metadata of an IP Assignment +*DevicesApi* | [**FindIPAssignments**](docs/DevicesApi.md#findipassignments) | **Get** /devices/{id}/ips | Retrieve all ip assignments +*DevicesApi* | [**FindInstanceBandwidth**](docs/DevicesApi.md#findinstancebandwidth) | **Get** /devices/{id}/bandwidth | Retrieve an instance bandwidth +*DevicesApi* | [**FindOrganizationDevices**](docs/DevicesApi.md#findorganizationdevices) | **Get** /organizations/{id}/devices | Retrieve all devices of an organization +*DevicesApi* | [**FindProjectDevices**](docs/DevicesApi.md#findprojectdevices) | **Get** /projects/{id}/devices | Retrieve all devices of a project +*DevicesApi* | [**FindTraffic**](docs/DevicesApi.md#findtraffic) | **Get** /devices/{id}/traffic | Retrieve device traffic +*DevicesApi* | [**GetBgpNeighborData**](docs/DevicesApi.md#getbgpneighbordata) | **Get** /devices/{id}/bgp/neighbors | Retrieve BGP neighbor data for this device +*DevicesApi* | [**GetDeviceFirmwareSets**](docs/DevicesApi.md#getdevicefirmwaresets) | **Get** /devices/{id}/firmware-sets | Get Device's associated Firmware Set +*DevicesApi* | [**GetDeviceHealthRollup**](docs/DevicesApi.md#getdevicehealthrollup) | **Get** /devices/{id}/diagnostics/health/rollup | Get Device's Health Status +*DevicesApi* | [**PerformAction**](docs/DevicesApi.md#performaction) | **Post** /devices/{id}/actions | Perform an action +*DevicesApi* | [**UpdateDevice**](docs/DevicesApi.md#updatedevice) | **Put** /devices/{id} | Update the device +*EmailsApi* | [**CreateEmail**](docs/EmailsApi.md#createemail) | **Post** /emails | Create an email +*EmailsApi* | [**DeleteEmail**](docs/EmailsApi.md#deleteemail) | **Delete** /emails/{id} | Delete the email +*EmailsApi* | [**FindEmailById**](docs/EmailsApi.md#findemailbyid) | **Get** /emails/{id} | Retrieve an email +*EmailsApi* | [**UpdateEmail**](docs/EmailsApi.md#updateemail) | **Put** /emails/{id} | Update the email +*EventsApi* | [**FindDeviceEvents**](docs/EventsApi.md#finddeviceevents) | **Get** /devices/{id}/events | Retrieve device's events +*EventsApi* | [**FindEventById**](docs/EventsApi.md#findeventbyid) | **Get** /events/{id} | Retrieve an event +*EventsApi* | [**FindEvents**](docs/EventsApi.md#findevents) | **Get** /events | Retrieve current user's events +*EventsApi* | [**FindInterconnectionEvents**](docs/EventsApi.md#findinterconnectionevents) | **Get** /connections/{connection_id}/events | Retrieve interconnection events +*EventsApi* | [**FindInterconnectionPortEvents**](docs/EventsApi.md#findinterconnectionportevents) | **Get** /connections/{connection_id}/ports/{id}/events | Retrieve interconnection port events +*EventsApi* | [**FindOrganizationEvents**](docs/EventsApi.md#findorganizationevents) | **Get** /organizations/{id}/events | Retrieve organization's events +*EventsApi* | [**FindProjectEvents**](docs/EventsApi.md#findprojectevents) | **Get** /projects/{id}/events | Retrieve project's events +*EventsApi* | [**FindVirtualCircuitEvents**](docs/EventsApi.md#findvirtualcircuitevents) | **Get** /virtual-circuits/{id}/events | Retrieve virtual circuit events +*EventsApi* | [**FindVrfRouteEvents**](docs/EventsApi.md#findvrfrouteevents) | **Get** /routes/{id}/events | Retrieve VRF route events +*FacilitiesApi* | [**FindFacilities**](docs/FacilitiesApi.md#findfacilities) | **Get** /facilities | Retrieve all facilities +*FacilitiesApi* | [**FindFacilitiesByOrganization**](docs/FacilitiesApi.md#findfacilitiesbyorganization) | **Get** /organizations/{id}/facilities | Retrieve all facilities visible by the organization +*FacilitiesApi* | [**FindFacilitiesByProject**](docs/FacilitiesApi.md#findfacilitiesbyproject) | **Get** /projects/{id}/facilities | Retrieve all facilities visible by the project +*FirmwareSetsApi* | [**GetOrganizationFirmwareSets**](docs/FirmwareSetsApi.md#getorganizationfirmwaresets) | **Get** /organizations/{id}/firmware-sets | Get Organization's Firmware Sets +*FirmwareSetsApi* | [**GetProjectFirmwareSets**](docs/FirmwareSetsApi.md#getprojectfirmwaresets) | **Get** /projects/{id}/firmware-sets | Get Project's Firmware Sets +*HardwareReservationsApi* | [**ActivateHardwareReservation**](docs/HardwareReservationsApi.md#activatehardwarereservation) | **Post** /hardware-reservations/{id}/activate | Activate a spare hardware reservation +*HardwareReservationsApi* | [**FindHardwareReservationById**](docs/HardwareReservationsApi.md#findhardwarereservationbyid) | **Get** /hardware-reservations/{id} | Retrieve a hardware reservation +*HardwareReservationsApi* | [**FindProjectHardwareReservations**](docs/HardwareReservationsApi.md#findprojecthardwarereservations) | **Get** /projects/{id}/hardware-reservations | Retrieve all hardware reservations for a given project +*HardwareReservationsApi* | [**MoveHardwareReservation**](docs/HardwareReservationsApi.md#movehardwarereservation) | **Post** /hardware-reservations/{id}/move | Move a hardware reservation +*IPAddressesApi* | [**DeleteIPAddress**](docs/IPAddressesApi.md#deleteipaddress) | **Delete** /ips/{id} | Unassign an ip address +*IPAddressesApi* | [**FindIPAddressById**](docs/IPAddressesApi.md#findipaddressbyid) | **Get** /ips/{id} | Retrieve an ip address +*IPAddressesApi* | [**FindIPAddressCustomdata**](docs/IPAddressesApi.md#findipaddresscustomdata) | **Get** /ips/{id}/customdata | Retrieve the custom metadata of an IP Reservation or IP Assignment +*IPAddressesApi* | [**FindIPAvailabilities**](docs/IPAddressesApi.md#findipavailabilities) | **Get** /ips/{id}/available | Retrieve all available subnets of a particular reservation +*IPAddressesApi* | [**FindIPReservations**](docs/IPAddressesApi.md#findipreservations) | **Get** /projects/{id}/ips | Retrieve all ip reservations +*IPAddressesApi* | [**RequestIPReservation**](docs/IPAddressesApi.md#requestipreservation) | **Post** /projects/{id}/ips | Requesting IP reservations +*IPAddressesApi* | [**UpdateIPAddress**](docs/IPAddressesApi.md#updateipaddress) | **Patch** /ips/{id} | Update an ip address +*IncidentsApi* | [**FindIncidents**](docs/IncidentsApi.md#findincidents) | **Get** /incidents | Retrieve the number of incidents +*InterconnectionsApi* | [**CreateInterconnectionPortVirtualCircuit**](docs/InterconnectionsApi.md#createinterconnectionportvirtualcircuit) | **Post** /connections/{connection_id}/ports/{port_id}/virtual-circuits | Create a new Virtual Circuit +*InterconnectionsApi* | [**CreateOrganizationInterconnection**](docs/InterconnectionsApi.md#createorganizationinterconnection) | **Post** /organizations/{organization_id}/connections | Request a new interconnection for the organization +*InterconnectionsApi* | [**CreateProjectInterconnection**](docs/InterconnectionsApi.md#createprojectinterconnection) | **Post** /projects/{project_id}/connections | Request a new interconnection for the project's organization +*InterconnectionsApi* | [**DeleteInterconnection**](docs/InterconnectionsApi.md#deleteinterconnection) | **Delete** /connections/{connection_id} | Delete interconnection +*InterconnectionsApi* | [**DeleteVirtualCircuit**](docs/InterconnectionsApi.md#deletevirtualcircuit) | **Delete** /virtual-circuits/{id} | Delete a virtual circuit +*InterconnectionsApi* | [**GetInterconnection**](docs/InterconnectionsApi.md#getinterconnection) | **Get** /connections/{connection_id} | Get interconnection +*InterconnectionsApi* | [**GetInterconnectionPort**](docs/InterconnectionsApi.md#getinterconnectionport) | **Get** /connections/{connection_id}/ports/{id} | Get a interconnection port +*InterconnectionsApi* | [**GetVirtualCircuit**](docs/InterconnectionsApi.md#getvirtualcircuit) | **Get** /virtual-circuits/{id} | Get a virtual circuit +*InterconnectionsApi* | [**ListInterconnectionPortVirtualCircuits**](docs/InterconnectionsApi.md#listinterconnectionportvirtualcircuits) | **Get** /connections/{connection_id}/ports/{port_id}/virtual-circuits | List a interconnection port's virtual circuits +*InterconnectionsApi* | [**ListInterconnectionPorts**](docs/InterconnectionsApi.md#listinterconnectionports) | **Get** /connections/{connection_id}/ports | List a interconnection's ports +*InterconnectionsApi* | [**ListInterconnectionVirtualCircuits**](docs/InterconnectionsApi.md#listinterconnectionvirtualcircuits) | **Get** /connections/{connection_id}/virtual-circuits | List a interconnection's virtual circuits +*InterconnectionsApi* | [**OrganizationListInterconnections**](docs/InterconnectionsApi.md#organizationlistinterconnections) | **Get** /organizations/{organization_id}/connections | List organization connections +*InterconnectionsApi* | [**ProjectListInterconnections**](docs/InterconnectionsApi.md#projectlistinterconnections) | **Get** /projects/{project_id}/connections | List project connections +*InterconnectionsApi* | [**UpdateInterconnection**](docs/InterconnectionsApi.md#updateinterconnection) | **Put** /connections/{connection_id} | Update interconnection +*InterconnectionsApi* | [**UpdateVirtualCircuit**](docs/InterconnectionsApi.md#updatevirtualcircuit) | **Put** /virtual-circuits/{id} | Update a virtual circuit +*InvitationsApi* | [**AcceptInvitation**](docs/InvitationsApi.md#acceptinvitation) | **Put** /invitations/{id} | Accept an invitation +*InvitationsApi* | [**DeclineInvitation**](docs/InvitationsApi.md#declineinvitation) | **Delete** /invitations/{id} | Decline an invitation +*InvitationsApi* | [**FindInvitationById**](docs/InvitationsApi.md#findinvitationbyid) | **Get** /invitations/{id} | View an invitation +*InvoicesApi* | [**FindOrganizationInvoices**](docs/InvoicesApi.md#findorganizationinvoices) | **Get** /organizations/{id}/invoices | Retrieve all invoices for an organization +*InvoicesApi* | [**GetInvoiceById**](docs/InvoicesApi.md#getinvoicebyid) | **Get** /invoices/{id} | Retrieve an invoice +*LicensesApi* | [**CreateLicense**](docs/LicensesApi.md#createlicense) | **Post** /projects/{id}/licenses | Create a License +*LicensesApi* | [**DeleteLicense**](docs/LicensesApi.md#deletelicense) | **Delete** /licenses/{id} | Delete the license +*LicensesApi* | [**FindLicenseById**](docs/LicensesApi.md#findlicensebyid) | **Get** /licenses/{id} | Retrieve a license +*LicensesApi* | [**FindProjectLicenses**](docs/LicensesApi.md#findprojectlicenses) | **Get** /projects/{id}/licenses | Retrieve all licenses +*LicensesApi* | [**UpdateLicense**](docs/LicensesApi.md#updatelicense) | **Put** /licenses/{id} | Update the license +*MembershipsApi* | [**DeleteMembership**](docs/MembershipsApi.md#deletemembership) | **Delete** /memberships/{id} | Delete the membership +*MembershipsApi* | [**FindMembershipById**](docs/MembershipsApi.md#findmembershipbyid) | **Get** /memberships/{id} | Retrieve a membership +*MembershipsApi* | [**UpdateMembership**](docs/MembershipsApi.md#updatemembership) | **Put** /memberships/{id} | Update the membership +*MetalGatewaysApi* | [**CreateMetalGateway**](docs/MetalGatewaysApi.md#createmetalgateway) | **Post** /projects/{project_id}/metal-gateways | Create a metal gateway +*MetalGatewaysApi* | [**CreateMetalGatewayElasticIp**](docs/MetalGatewaysApi.md#createmetalgatewayelasticip) | **Post** /metal-gateways/{id}/ips | Create a Metal Gateway Elastic IP +*MetalGatewaysApi* | [**DeleteMetalGateway**](docs/MetalGatewaysApi.md#deletemetalgateway) | **Delete** /metal-gateways/{id} | Deletes the metal gateway +*MetalGatewaysApi* | [**FindMetalGatewayById**](docs/MetalGatewaysApi.md#findmetalgatewaybyid) | **Get** /metal-gateways/{id} | Returns the metal gateway +*MetalGatewaysApi* | [**FindMetalGatewaysByProject**](docs/MetalGatewaysApi.md#findmetalgatewaysbyproject) | **Get** /projects/{project_id}/metal-gateways | Returns all metal gateways for a project +*MetalGatewaysApi* | [**GetMetalGatewayElasticIps**](docs/MetalGatewaysApi.md#getmetalgatewayelasticips) | **Get** /metal-gateways/{id}/ips | List Metal Gateway Elastic IPs +*MetrosApi* | [**FindMetros**](docs/MetrosApi.md#findmetros) | **Get** /locations/metros | Retrieve all metros +*MetrosApi* | [**GetMetro**](docs/MetrosApi.md#getmetro) | **Get** /locations/metros/{id} | Retrieve a specific Metro's details +*OTPsApi* | [**FindEnsureOtp**](docs/OTPsApi.md#findensureotp) | **Post** /user/otp/verify/{otp} | Verify user by providing an OTP +*OTPsApi* | [**FindRecoveryCodes**](docs/OTPsApi.md#findrecoverycodes) | **Get** /user/otp/recovery-codes | Retrieve my recovery codes +*OTPsApi* | [**ReceiveCodes**](docs/OTPsApi.md#receivecodes) | **Post** /user/otp/sms/receive | Receive an OTP per sms +*OTPsApi* | [**RegenerateCodes**](docs/OTPsApi.md#regeneratecodes) | **Post** /user/otp/recovery-codes | Generate new recovery codes +*OTPsApi* | [**SeedApp**](docs/OTPsApi.md#seedapp) | **Post** /user/otp/app/receive | Issue OTP seeds +*OperatingSystemsApi* | [**FindOperatingSystemVersion**](docs/OperatingSystemsApi.md#findoperatingsystemversion) | **Get** /operating-system-versions | Retrieve all operating system versions +*OperatingSystemsApi* | [**FindOperatingSystems**](docs/OperatingSystemsApi.md#findoperatingsystems) | **Get** /operating-systems | Retrieve all operating systems +*OrganizationsApi* | [**CreateOrganization**](docs/OrganizationsApi.md#createorganization) | **Post** /organizations | Create an organization +*OrganizationsApi* | [**CreateOrganizationInvitation**](docs/OrganizationsApi.md#createorganizationinvitation) | **Post** /organizations/{id}/invitations | Create an invitation for an organization +*OrganizationsApi* | [**CreateOrganizationProject**](docs/OrganizationsApi.md#createorganizationproject) | **Post** /organizations/{id}/projects | Create a project for the organization +*OrganizationsApi* | [**CreatePaymentMethod**](docs/OrganizationsApi.md#createpaymentmethod) | **Post** /organizations/{id}/payment-methods | Create a payment method for the given organization +*OrganizationsApi* | [**DeleteOrganization**](docs/OrganizationsApi.md#deleteorganization) | **Delete** /organizations/{id} | Delete the organization +*OrganizationsApi* | [**FindOperatingSystemsByOrganization**](docs/OrganizationsApi.md#findoperatingsystemsbyorganization) | **Get** /organizations/{id}/operating-systems | Retrieve all operating systems visible by the organization +*OrganizationsApi* | [**FindOrganizationById**](docs/OrganizationsApi.md#findorganizationbyid) | **Get** /organizations/{id} | Retrieve an organization's details +*OrganizationsApi* | [**FindOrganizationCustomdata**](docs/OrganizationsApi.md#findorganizationcustomdata) | **Get** /organizations/{id}/customdata | Retrieve the custom metadata of an organization +*OrganizationsApi* | [**FindOrganizationInvitations**](docs/OrganizationsApi.md#findorganizationinvitations) | **Get** /organizations/{id}/invitations | Retrieve organization invitations +*OrganizationsApi* | [**FindOrganizationPaymentMethods**](docs/OrganizationsApi.md#findorganizationpaymentmethods) | **Get** /organizations/{id}/payment-methods | Retrieve all payment methods of an organization +*OrganizationsApi* | [**FindOrganizationProjects**](docs/OrganizationsApi.md#findorganizationprojects) | **Get** /organizations/{id}/projects | Retrieve all projects of an organization +*OrganizationsApi* | [**FindOrganizationTransfers**](docs/OrganizationsApi.md#findorganizationtransfers) | **Get** /organizations/{id}/transfers | Retrieve all project transfer requests from or to an organization +*OrganizationsApi* | [**FindOrganizations**](docs/OrganizationsApi.md#findorganizations) | **Get** /organizations | Retrieve all organizations +*OrganizationsApi* | [**FindPlansByOrganization**](docs/OrganizationsApi.md#findplansbyorganization) | **Get** /organizations/{id}/plans | Retrieve all plans visible by the organization +*OrganizationsApi* | [**UpdateOrganization**](docs/OrganizationsApi.md#updateorganization) | **Put** /organizations/{id} | Update the organization +*PasswordResetTokensApi* | [**CreatePasswordResetToken**](docs/PasswordResetTokensApi.md#createpasswordresettoken) | **Post** /reset-password | Create a password reset token +*PasswordResetTokensApi* | [**ResetPassword**](docs/PasswordResetTokensApi.md#resetpassword) | **Delete** /reset-password | Reset current user password +*PaymentMethodsApi* | [**DeletePaymentMethod**](docs/PaymentMethodsApi.md#deletepaymentmethod) | **Delete** /payment-methods/{id} | Delete the payment method +*PaymentMethodsApi* | [**FindPaymentMethodById**](docs/PaymentMethodsApi.md#findpaymentmethodbyid) | **Get** /payment-methods/{id} | Retrieve a payment method +*PaymentMethodsApi* | [**UpdatePaymentMethod**](docs/PaymentMethodsApi.md#updatepaymentmethod) | **Put** /payment-methods/{id} | Update the payment method +*PlansApi* | [**FindPlans**](docs/PlansApi.md#findplans) | **Get** /plans | Retrieve all plans +*PlansApi* | [**FindPlansByProject**](docs/PlansApi.md#findplansbyproject) | **Get** /projects/{id}/plans | Retrieve all plans visible by the project +*PortsApi* | [**AssignNativeVlan**](docs/PortsApi.md#assignnativevlan) | **Post** /ports/{id}/native-vlan | Assign a native VLAN +*PortsApi* | [**AssignPort**](docs/PortsApi.md#assignport) | **Post** /ports/{id}/assign | Assign a port to virtual network +*PortsApi* | [**BondPort**](docs/PortsApi.md#bondport) | **Post** /ports/{id}/bond | Enabling bonding +*PortsApi* | [**ConvertLayer2**](docs/PortsApi.md#convertlayer2) | **Post** /ports/{id}/convert/layer-2 | Convert to Layer 2 +*PortsApi* | [**ConvertLayer3**](docs/PortsApi.md#convertlayer3) | **Post** /ports/{id}/convert/layer-3 | Convert to Layer 3 +*PortsApi* | [**CreatePortVlanAssignmentBatch**](docs/PortsApi.md#createportvlanassignmentbatch) | **Post** /ports/{id}/vlan-assignments/batches | Create a new Port-VLAN Assignment management batch +*PortsApi* | [**DeleteNativeVlan**](docs/PortsApi.md#deletenativevlan) | **Delete** /ports/{id}/native-vlan | Remove native VLAN +*PortsApi* | [**DisbondPort**](docs/PortsApi.md#disbondport) | **Post** /ports/{id}/disbond | Disabling bonding +*PortsApi* | [**FindPortById**](docs/PortsApi.md#findportbyid) | **Get** /ports/{id} | Retrieve a port +*PortsApi* | [**FindPortVlanAssignmentBatchByPortIdAndBatchId**](docs/PortsApi.md#findportvlanassignmentbatchbyportidandbatchid) | **Get** /ports/{id}/vlan-assignments/batches/{batch_id} | Retrieve a VLAN Assignment Batch's details +*PortsApi* | [**FindPortVlanAssignmentBatches**](docs/PortsApi.md#findportvlanassignmentbatches) | **Get** /ports/{id}/vlan-assignments/batches | List the VLAN Assignment Batches for a port +*PortsApi* | [**FindPortVlanAssignmentByPortIdAndAssignmentId**](docs/PortsApi.md#findportvlanassignmentbyportidandassignmentid) | **Get** /ports/{id}/vlan-assignments/{assignment_id} | Show a particular Port VLAN assignment's details +*PortsApi* | [**FindPortVlanAssignments**](docs/PortsApi.md#findportvlanassignments) | **Get** /ports/{id}/vlan-assignments | List Current VLAN assignments for a port +*PortsApi* | [**UnassignPort**](docs/PortsApi.md#unassignport) | **Post** /ports/{id}/unassign | Unassign a port +*ProjectsApi* | [**CreateProject**](docs/ProjectsApi.md#createproject) | **Post** /projects | Create a project +*ProjectsApi* | [**CreateProjectInvitation**](docs/ProjectsApi.md#createprojectinvitation) | **Post** /projects/{project_id}/invitations | Create an invitation for a project +*ProjectsApi* | [**CreateTransferRequest**](docs/ProjectsApi.md#createtransferrequest) | **Post** /projects/{id}/transfers | Create a transfer request +*ProjectsApi* | [**DeleteProject**](docs/ProjectsApi.md#deleteproject) | **Delete** /projects/{id} | Delete the project +*ProjectsApi* | [**FindIPReservationCustomdata**](docs/ProjectsApi.md#findipreservationcustomdata) | **Get** /projects/{project_id}/ips/{id}/customdata | Retrieve the custom metadata of an IP Reservation +*ProjectsApi* | [**FindProjectById**](docs/ProjectsApi.md#findprojectbyid) | **Get** /projects/{id} | Retrieve a project +*ProjectsApi* | [**FindProjectCustomdata**](docs/ProjectsApi.md#findprojectcustomdata) | **Get** /projects/{id}/customdata | Retrieve the custom metadata of a project +*ProjectsApi* | [**FindProjectInvitations**](docs/ProjectsApi.md#findprojectinvitations) | **Get** /projects/{project_id}/invitations | Retrieve project invitations +*ProjectsApi* | [**FindProjectMemberships**](docs/ProjectsApi.md#findprojectmemberships) | **Get** /projects/{project_id}/memberships | Retrieve project memberships +*ProjectsApi* | [**FindProjects**](docs/ProjectsApi.md#findprojects) | **Get** /projects | Retrieve all projects +*ProjectsApi* | [**UpdateProject**](docs/ProjectsApi.md#updateproject) | **Put** /projects/{id} | Update the project +*SSHKeysApi* | [**CreateProjectSSHKey**](docs/SSHKeysApi.md#createprojectsshkey) | **Post** /projects/{id}/ssh-keys | Create a ssh key for the given project +*SSHKeysApi* | [**CreateSSHKey**](docs/SSHKeysApi.md#createsshkey) | **Post** /ssh-keys | Create a ssh key for the current user +*SSHKeysApi* | [**DeleteSSHKey**](docs/SSHKeysApi.md#deletesshkey) | **Delete** /ssh-keys/{id} | Delete the ssh key +*SSHKeysApi* | [**FindDeviceSSHKeys**](docs/SSHKeysApi.md#finddevicesshkeys) | **Get** /devices/{id}/ssh-keys | Retrieve a device's ssh keys +*SSHKeysApi* | [**FindProjectSSHKeys**](docs/SSHKeysApi.md#findprojectsshkeys) | **Get** /projects/{id}/ssh-keys | Retrieve a project's ssh keys +*SSHKeysApi* | [**FindSSHKeyById**](docs/SSHKeysApi.md#findsshkeybyid) | **Get** /ssh-keys/{id} | Retrieve a ssh key +*SSHKeysApi* | [**FindSSHKeys**](docs/SSHKeysApi.md#findsshkeys) | **Get** /ssh-keys | Retrieve all ssh keys +*SSHKeysApi* | [**UpdateSSHKey**](docs/SSHKeysApi.md#updatesshkey) | **Put** /ssh-keys/{id} | Update the ssh key +*SelfServiceReservationsApi* | [**CreateSelfServiceReservation**](docs/SelfServiceReservationsApi.md#createselfservicereservation) | **Post** /projects/{project_id}/self-service/reservations | Create a reservation +*SelfServiceReservationsApi* | [**FindSelfServiceReservation**](docs/SelfServiceReservationsApi.md#findselfservicereservation) | **Get** /projects/{project_id}/self-service/reservations/{id} | Retrieve a reservation +*SelfServiceReservationsApi* | [**FindSelfServiceReservations**](docs/SelfServiceReservationsApi.md#findselfservicereservations) | **Get** /projects/{project_id}/self-service/reservations | Retrieve all reservations +*SpotMarketApi* | [**CreateSpotMarketRequest**](docs/SpotMarketApi.md#createspotmarketrequest) | **Post** /projects/{id}/spot-market-requests | Create a spot market request +*SpotMarketApi* | [**DeleteSpotMarketRequest**](docs/SpotMarketApi.md#deletespotmarketrequest) | **Delete** /spot-market-requests/{id} | Delete the spot market request +*SpotMarketApi* | [**FindMetroSpotMarketPrices**](docs/SpotMarketApi.md#findmetrospotmarketprices) | **Get** /market/spot/prices/metros | Get current spot market prices for metros +*SpotMarketApi* | [**FindSpotMarketPrices**](docs/SpotMarketApi.md#findspotmarketprices) | **Get** /market/spot/prices | Get current spot market prices +*SpotMarketApi* | [**FindSpotMarketPricesHistory**](docs/SpotMarketApi.md#findspotmarketpriceshistory) | **Get** /market/spot/prices/history | Get spot market prices for a given period of time +*SpotMarketApi* | [**FindSpotMarketRequestById**](docs/SpotMarketApi.md#findspotmarketrequestbyid) | **Get** /spot-market-requests/{id} | Retrieve a spot market request +*SpotMarketApi* | [**ListSpotMarketRequests**](docs/SpotMarketApi.md#listspotmarketrequests) | **Get** /projects/{id}/spot-market-requests | List spot market requests +*SupportRequestApi* | [**RequestSuppert**](docs/SupportRequestApi.md#requestsuppert) | **Post** /support-requests | Create a support ticket +*TransferRequestsApi* | [**AcceptTransferRequest**](docs/TransferRequestsApi.md#accepttransferrequest) | **Put** /transfers/{id} | Accept a transfer request +*TransferRequestsApi* | [**DeclineTransferRequest**](docs/TransferRequestsApi.md#declinetransferrequest) | **Delete** /transfers/{id} | Decline a transfer request +*TransferRequestsApi* | [**FindTransferRequestById**](docs/TransferRequestsApi.md#findtransferrequestbyid) | **Get** /transfers/{id} | View a transfer request +*TwoFactorAuthApi* | [**DisableTfaApp**](docs/TwoFactorAuthApi.md#disabletfaapp) | **Delete** /user/otp/app | Disable two factor authentication +*TwoFactorAuthApi* | [**DisableTfaSms**](docs/TwoFactorAuthApi.md#disabletfasms) | **Delete** /user/otp/sms | Disable two factor authentication +*TwoFactorAuthApi* | [**EnableTfaApp**](docs/TwoFactorAuthApi.md#enabletfaapp) | **Post** /user/otp/app | Enable two factor auth using app +*TwoFactorAuthApi* | [**EnableTfaSms**](docs/TwoFactorAuthApi.md#enabletfasms) | **Post** /user/otp/sms | Enable two factor auth using sms +*UsagesApi* | [**FindDeviceUsages**](docs/UsagesApi.md#finddeviceusages) | **Get** /devices/{id}/usages | Retrieve all usages for device +*UsagesApi* | [**FindProjectUsage**](docs/UsagesApi.md#findprojectusage) | **Get** /projects/{id}/usages | Retrieve all usages for project +*UserVerificationTokensApi* | [**ConsumeVerificationRequest**](docs/UserVerificationTokensApi.md#consumeverificationrequest) | **Put** /verify-email | Verify a user using an email verification token +*UserVerificationTokensApi* | [**CreateValidationRequest**](docs/UserVerificationTokensApi.md#createvalidationrequest) | **Post** /verify-email | Create an email verification request +*UserdataApi* | [**ValidateUserdata**](docs/UserdataApi.md#validateuserdata) | **Post** /userdata/validate | Validate user data +*UsersApi* | [**CreateUser**](docs/UsersApi.md#createuser) | **Post** /users | Create a user +*UsersApi* | [**FindCurrentUser**](docs/UsersApi.md#findcurrentuser) | **Get** /user | Retrieve the current user +*UsersApi* | [**FindInvitations**](docs/UsersApi.md#findinvitations) | **Get** /invitations | Retrieve current user invitations +*UsersApi* | [**FindUserById**](docs/UsersApi.md#finduserbyid) | **Get** /users/{id} | Retrieve a user +*UsersApi* | [**FindUserCustomdata**](docs/UsersApi.md#findusercustomdata) | **Get** /users/{id}/customdata | Retrieve the custom metadata of a user +*UsersApi* | [**FindUsers**](docs/UsersApi.md#findusers) | **Get** /users | Retrieve all users +*UsersApi* | [**UpdateCurrentUser**](docs/UsersApi.md#updatecurrentuser) | **Put** /user | Update the current user +*VLANsApi* | [**CreateVirtualNetwork**](docs/VLANsApi.md#createvirtualnetwork) | **Post** /projects/{id}/virtual-networks | Create a virtual network +*VLANsApi* | [**DeleteVirtualNetwork**](docs/VLANsApi.md#deletevirtualnetwork) | **Delete** /virtual-networks/{id} | Delete a virtual network +*VLANsApi* | [**FindVirtualNetworks**](docs/VLANsApi.md#findvirtualnetworks) | **Get** /projects/{id}/virtual-networks | Retrieve all virtual networks +*VLANsApi* | [**GetVirtualNetwork**](docs/VLANsApi.md#getvirtualnetwork) | **Get** /virtual-networks/{id} | Get a virtual network +*VRFsApi* | [**BgpDynamicNeighborsIdGet**](docs/VRFsApi.md#bgpdynamicneighborsidget) | **Get** /bgp-dynamic-neighbors/{id} | Retrieve a BGP Dynamic Neighbor +*VRFsApi* | [**CreateBgpDynamicNeighbor**](docs/VRFsApi.md#createbgpdynamicneighbor) | **Post** /metal-gateways/{id}/bgp-dynamic-neighbors | Create a VRF BGP Dynamic Neighbor range +*VRFsApi* | [**CreateVrf**](docs/VRFsApi.md#createvrf) | **Post** /projects/{id}/vrfs | Create a new VRF in the specified project +*VRFsApi* | [**CreateVrfRoute**](docs/VRFsApi.md#createvrfroute) | **Post** /vrfs/{id}/routes | Create a VRF route +*VRFsApi* | [**DeleteBgpDynamicNeighborById**](docs/VRFsApi.md#deletebgpdynamicneighborbyid) | **Delete** /bgp-dynamic-neighbors/{id} | Delete a VRF BGP Dynamic Neighbor +*VRFsApi* | [**DeleteVrf**](docs/VRFsApi.md#deletevrf) | **Delete** /vrfs/{id} | Delete the VRF +*VRFsApi* | [**DeleteVrfRouteById**](docs/VRFsApi.md#deletevrfroutebyid) | **Delete** /routes/{id} | Delete a VRF Route +*VRFsApi* | [**FindVrfById**](docs/VRFsApi.md#findvrfbyid) | **Get** /vrfs/{id} | Retrieve a VRF +*VRFsApi* | [**FindVrfIpReservation**](docs/VRFsApi.md#findvrfipreservation) | **Get** /vrfs/{vrf_id}/ips/{id} | Retrieve all VRF IP Reservations in the VRF +*VRFsApi* | [**FindVrfIpReservations**](docs/VRFsApi.md#findvrfipreservations) | **Get** /vrfs/{id}/ips | Retrieve all VRF IP Reservations in the VRF +*VRFsApi* | [**FindVrfRouteById**](docs/VRFsApi.md#findvrfroutebyid) | **Get** /routes/{id} | Retrieve a VRF Route +*VRFsApi* | [**FindVrfs**](docs/VRFsApi.md#findvrfs) | **Get** /projects/{id}/vrfs | Retrieve all VRFs in the project +*VRFsApi* | [**GetBgpDynamicNeighbors**](docs/VRFsApi.md#getbgpdynamicneighbors) | **Get** /metal-gateways/{id}/bgp-dynamic-neighbors | List BGP Dynamic Neighbors +*VRFsApi* | [**GetVrfRoutes**](docs/VRFsApi.md#getvrfroutes) | **Get** /vrfs/{id}/routes | Retrieve all routes in the VRF +*VRFsApi* | [**UpdateVrf**](docs/VRFsApi.md#updatevrf) | **Put** /vrfs/{id} | Update the VRF +*VRFsApi* | [**UpdateVrfRouteById**](docs/VRFsApi.md#updatevrfroutebyid) | **Put** /routes/{id} | Update a VRF Route + + +## Documentation For Models + + - [ActivateHardwareReservationRequest](docs/ActivateHardwareReservationRequest.md) + - [Address](docs/Address.md) + - [Attribute](docs/Attribute.md) + - [AttributeData](docs/AttributeData.md) + - [AuthToken](docs/AuthToken.md) + - [AuthTokenInput](docs/AuthTokenInput.md) + - [AuthTokenList](docs/AuthTokenList.md) + - [AuthTokenProject](docs/AuthTokenProject.md) + - [AuthTokenUser](docs/AuthTokenUser.md) + - [BGPSessionInput](docs/BGPSessionInput.md) + - [BGPSessionInputAddressFamily](docs/BGPSessionInputAddressFamily.md) + - [Batch](docs/Batch.md) + - [BatchesList](docs/BatchesList.md) + - [BgpConfig](docs/BgpConfig.md) + - [BgpConfigDeploymentType](docs/BgpConfigDeploymentType.md) + - [BgpConfigRequestInput](docs/BgpConfigRequestInput.md) + - [BgpConfigRequestInputDeploymentType](docs/BgpConfigRequestInputDeploymentType.md) + - [BgpConfigStatus](docs/BgpConfigStatus.md) + - [BgpDynamicNeighbor](docs/BgpDynamicNeighbor.md) + - [BgpDynamicNeighborCreateInput](docs/BgpDynamicNeighborCreateInput.md) + - [BgpDynamicNeighborList](docs/BgpDynamicNeighborList.md) + - [BgpDynamicNeighborState](docs/BgpDynamicNeighborState.md) + - [BgpNeighborData](docs/BgpNeighborData.md) + - [BgpRoute](docs/BgpRoute.md) + - [BgpSession](docs/BgpSession.md) + - [BgpSessionAddressFamily](docs/BgpSessionAddressFamily.md) + - [BgpSessionList](docs/BgpSessionList.md) + - [BgpSessionNeighbors](docs/BgpSessionNeighbors.md) + - [BondPortData](docs/BondPortData.md) + - [CapacityCheckPerFacilityInfo](docs/CapacityCheckPerFacilityInfo.md) + - [CapacityCheckPerFacilityList](docs/CapacityCheckPerFacilityList.md) + - [CapacityCheckPerMetroInfo](docs/CapacityCheckPerMetroInfo.md) + - [CapacityCheckPerMetroList](docs/CapacityCheckPerMetroList.md) + - [CapacityInput](docs/CapacityInput.md) + - [CapacityLevelPerBaremetal](docs/CapacityLevelPerBaremetal.md) + - [CapacityList](docs/CapacityList.md) + - [Component](docs/Component.md) + - [Coordinates](docs/Coordinates.md) + - [CreateDeviceRequest](docs/CreateDeviceRequest.md) + - [CreateEmailInput](docs/CreateEmailInput.md) + - [CreateMetalGatewayRequest](docs/CreateMetalGatewayRequest.md) + - [CreateOrganizationInterconnectionRequest](docs/CreateOrganizationInterconnectionRequest.md) + - [CreateSelfServiceReservationRequest](docs/CreateSelfServiceReservationRequest.md) + - [CreateSelfServiceReservationRequestPeriod](docs/CreateSelfServiceReservationRequestPeriod.md) + - [CreateSelfServiceReservationRequestPeriodCount](docs/CreateSelfServiceReservationRequestPeriodCount.md) + - [CreateSelfServiceReservationRequestPeriodUnit](docs/CreateSelfServiceReservationRequestPeriodUnit.md) + - [DedicatedPortCreateInput](docs/DedicatedPortCreateInput.md) + - [DedicatedPortCreateInputMode](docs/DedicatedPortCreateInputMode.md) + - [DedicatedPortCreateInputType](docs/DedicatedPortCreateInputType.md) + - [Device](docs/Device.md) + - [DeviceActionInput](docs/DeviceActionInput.md) + - [DeviceActionInputType](docs/DeviceActionInputType.md) + - [DeviceActionsInner](docs/DeviceActionsInner.md) + - [DeviceCreateInFacilityInput](docs/DeviceCreateInFacilityInput.md) + - [DeviceCreateInMetroInput](docs/DeviceCreateInMetroInput.md) + - [DeviceCreateInput](docs/DeviceCreateInput.md) + - [DeviceCreateInputBillingCycle](docs/DeviceCreateInputBillingCycle.md) + - [DeviceCreatedBy](docs/DeviceCreatedBy.md) + - [DeviceHealthRollup](docs/DeviceHealthRollup.md) + - [DeviceHealthRollupHealthRollup](docs/DeviceHealthRollupHealthRollup.md) + - [DeviceList](docs/DeviceList.md) + - [DeviceMetro](docs/DeviceMetro.md) + - [DeviceProjectLite](docs/DeviceProjectLite.md) + - [DeviceState](docs/DeviceState.md) + - [DeviceUpdateInput](docs/DeviceUpdateInput.md) + - [DeviceUsage](docs/DeviceUsage.md) + - [DeviceUsageList](docs/DeviceUsageList.md) + - [Disk](docs/Disk.md) + - [Email](docs/Email.md) + - [EmailInput](docs/EmailInput.md) + - [Entitlement](docs/Entitlement.md) + - [Error](docs/Error.md) + - [Event](docs/Event.md) + - [EventList](docs/EventList.md) + - [FabricServiceToken](docs/FabricServiceToken.md) + - [FabricServiceTokenRole](docs/FabricServiceTokenRole.md) + - [FabricServiceTokenServiceTokenType](docs/FabricServiceTokenServiceTokenType.md) + - [FabricServiceTokenState](docs/FabricServiceTokenState.md) + - [Facility](docs/Facility.md) + - [FacilityFeaturesInner](docs/FacilityFeaturesInner.md) + - [FacilityInput](docs/FacilityInput.md) + - [FacilityList](docs/FacilityList.md) + - [Filesystem](docs/Filesystem.md) + - [FindFacilitiesIncludeParameterInner](docs/FindFacilitiesIncludeParameterInner.md) + - [FindIPAddressById200Response](docs/FindIPAddressById200Response.md) + - [FindIPAvailabilitiesCidrParameter](docs/FindIPAvailabilitiesCidrParameter.md) + - [FindIPReservationsTypesParameterInner](docs/FindIPReservationsTypesParameterInner.md) + - [FindMetalGatewayById200Response](docs/FindMetalGatewayById200Response.md) + - [FindOrganizationDevicesCategoriesParameterInner](docs/FindOrganizationDevicesCategoriesParameterInner.md) + - [FindOrganizationsPersonalParameter](docs/FindOrganizationsPersonalParameter.md) + - [FindPlansTypeParameter](docs/FindPlansTypeParameter.md) + - [FindProjectHardwareReservationsProvisionableParameter](docs/FindProjectHardwareReservationsProvisionableParameter.md) + - [FindProjectHardwareReservationsStateParameter](docs/FindProjectHardwareReservationsStateParameter.md) + - [FindTrafficBucketParameter](docs/FindTrafficBucketParameter.md) + - [FindTrafficDirectionParameter](docs/FindTrafficDirectionParameter.md) + - [FindTrafficIntervalParameter](docs/FindTrafficIntervalParameter.md) + - [FindTrafficTimeframeParameter](docs/FindTrafficTimeframeParameter.md) + - [FirmwareSet](docs/FirmwareSet.md) + - [FirmwareSetListResponse](docs/FirmwareSetListResponse.md) + - [FirmwareSetResponse](docs/FirmwareSetResponse.md) + - [GlobalBgpRange](docs/GlobalBgpRange.md) + - [GlobalBgpRangeList](docs/GlobalBgpRangeList.md) + - [HardwareReservation](docs/HardwareReservation.md) + - [HardwareReservationList](docs/HardwareReservationList.md) + - [Href](docs/Href.md) + - [IPAddress](docs/IPAddress.md) + - [IPAddressAddressFamily](docs/IPAddressAddressFamily.md) + - [IPAssignment](docs/IPAssignment.md) + - [IPAssignmentInput](docs/IPAssignmentInput.md) + - [IPAssignmentList](docs/IPAssignmentList.md) + - [IPAssignmentMetro](docs/IPAssignmentMetro.md) + - [IPAssignmentState](docs/IPAssignmentState.md) + - [IPAssignmentType](docs/IPAssignmentType.md) + - [IPAssignmentUpdateInput](docs/IPAssignmentUpdateInput.md) + - [IPAvailabilitiesList](docs/IPAvailabilitiesList.md) + - [IPReservation](docs/IPReservation.md) + - [IPReservationFacility](docs/IPReservationFacility.md) + - [IPReservationList](docs/IPReservationList.md) + - [IPReservationListIpAddressesInner](docs/IPReservationListIpAddressesInner.md) + - [IPReservationMetro](docs/IPReservationMetro.md) + - [IPReservationRequestInput](docs/IPReservationRequestInput.md) + - [IPReservationType](docs/IPReservationType.md) + - [InstancesBatchCreateInput](docs/InstancesBatchCreateInput.md) + - [InstancesBatchCreateInputBatchesInner](docs/InstancesBatchCreateInputBatchesInner.md) + - [Interconnection](docs/Interconnection.md) + - [InterconnectionList](docs/InterconnectionList.md) + - [InterconnectionMode](docs/InterconnectionMode.md) + - [InterconnectionPort](docs/InterconnectionPort.md) + - [InterconnectionPortList](docs/InterconnectionPortList.md) + - [InterconnectionPortRole](docs/InterconnectionPortRole.md) + - [InterconnectionPortStatus](docs/InterconnectionPortStatus.md) + - [InterconnectionRedundancy](docs/InterconnectionRedundancy.md) + - [InterconnectionType](docs/InterconnectionType.md) + - [InterconnectionUpdateInput](docs/InterconnectionUpdateInput.md) + - [Invitation](docs/Invitation.md) + - [InvitationInput](docs/InvitationInput.md) + - [InvitationList](docs/InvitationList.md) + - [InvitationRolesInner](docs/InvitationRolesInner.md) + - [Invoice](docs/Invoice.md) + - [InvoiceList](docs/InvoiceList.md) + - [License](docs/License.md) + - [LicenseCreateInput](docs/LicenseCreateInput.md) + - [LicenseList](docs/LicenseList.md) + - [LicenseUpdateInput](docs/LicenseUpdateInput.md) + - [LineItem](docs/LineItem.md) + - [Membership](docs/Membership.md) + - [MembershipInput](docs/MembershipInput.md) + - [MembershipList](docs/MembershipList.md) + - [Meta](docs/Meta.md) + - [Metadata](docs/Metadata.md) + - [MetadataNetwork](docs/MetadataNetwork.md) + - [MetadataNetworkNetwork](docs/MetadataNetworkNetwork.md) + - [MetadataNetworkNetworkBonding](docs/MetadataNetworkNetworkBonding.md) + - [MetalGateway](docs/MetalGateway.md) + - [MetalGatewayCreateInput](docs/MetalGatewayCreateInput.md) + - [MetalGatewayElasticIpCreateInput](docs/MetalGatewayElasticIpCreateInput.md) + - [MetalGatewayList](docs/MetalGatewayList.md) + - [MetalGatewayListMetalGatewaysInner](docs/MetalGatewayListMetalGatewaysInner.md) + - [MetalGatewayLite](docs/MetalGatewayLite.md) + - [MetalGatewayState](docs/MetalGatewayState.md) + - [Metro](docs/Metro.md) + - [MetroInput](docs/MetroInput.md) + - [MetroList](docs/MetroList.md) + - [Mount](docs/Mount.md) + - [MoveHardwareReservationRequest](docs/MoveHardwareReservationRequest.md) + - [NewPassword](docs/NewPassword.md) + - [OperatingSystem](docs/OperatingSystem.md) + - [OperatingSystemList](docs/OperatingSystemList.md) + - [Organization](docs/Organization.md) + - [OrganizationInput](docs/OrganizationInput.md) + - [OrganizationList](docs/OrganizationList.md) + - [OtpSeed](docs/OtpSeed.md) + - [ParentBlock](docs/ParentBlock.md) + - [Partition](docs/Partition.md) + - [PaymentMethod](docs/PaymentMethod.md) + - [PaymentMethodBillingAddress](docs/PaymentMethodBillingAddress.md) + - [PaymentMethodCreateInput](docs/PaymentMethodCreateInput.md) + - [PaymentMethodList](docs/PaymentMethodList.md) + - [PaymentMethodUpdateInput](docs/PaymentMethodUpdateInput.md) + - [Plan](docs/Plan.md) + - [PlanAvailableInInner](docs/PlanAvailableInInner.md) + - [PlanAvailableInInnerPrice](docs/PlanAvailableInInnerPrice.md) + - [PlanAvailableInMetrosInner](docs/PlanAvailableInMetrosInner.md) + - [PlanDeploymentTypesInner](docs/PlanDeploymentTypesInner.md) + - [PlanList](docs/PlanList.md) + - [PlanSpecs](docs/PlanSpecs.md) + - [PlanSpecsCpusInner](docs/PlanSpecsCpusInner.md) + - [PlanSpecsDrivesInner](docs/PlanSpecsDrivesInner.md) + - [PlanSpecsDrivesInnerCategory](docs/PlanSpecsDrivesInnerCategory.md) + - [PlanSpecsFeatures](docs/PlanSpecsFeatures.md) + - [PlanSpecsMemory](docs/PlanSpecsMemory.md) + - [PlanSpecsNicsInner](docs/PlanSpecsNicsInner.md) + - [PlanType](docs/PlanType.md) + - [Port](docs/Port.md) + - [PortAssignInput](docs/PortAssignInput.md) + - [PortConvertLayer3Input](docs/PortConvertLayer3Input.md) + - [PortConvertLayer3InputRequestIpsInner](docs/PortConvertLayer3InputRequestIpsInner.md) + - [PortData](docs/PortData.md) + - [PortNetworkType](docs/PortNetworkType.md) + - [PortType](docs/PortType.md) + - [PortVlanAssignment](docs/PortVlanAssignment.md) + - [PortVlanAssignmentBatch](docs/PortVlanAssignmentBatch.md) + - [PortVlanAssignmentBatchCreateInput](docs/PortVlanAssignmentBatchCreateInput.md) + - [PortVlanAssignmentBatchCreateInputVlanAssignmentsInner](docs/PortVlanAssignmentBatchCreateInputVlanAssignmentsInner.md) + - [PortVlanAssignmentBatchList](docs/PortVlanAssignmentBatchList.md) + - [PortVlanAssignmentBatchState](docs/PortVlanAssignmentBatchState.md) + - [PortVlanAssignmentBatchVlanAssignmentsInner](docs/PortVlanAssignmentBatchVlanAssignmentsInner.md) + - [PortVlanAssignmentBatchVlanAssignmentsInnerState](docs/PortVlanAssignmentBatchVlanAssignmentsInnerState.md) + - [PortVlanAssignmentList](docs/PortVlanAssignmentList.md) + - [PortVlanAssignmentState](docs/PortVlanAssignmentState.md) + - [Project](docs/Project.md) + - [ProjectCreateFromRootInput](docs/ProjectCreateFromRootInput.md) + - [ProjectCreateFromRootInputType](docs/ProjectCreateFromRootInputType.md) + - [ProjectCreateInput](docs/ProjectCreateInput.md) + - [ProjectIdName](docs/ProjectIdName.md) + - [ProjectList](docs/ProjectList.md) + - [ProjectType](docs/ProjectType.md) + - [ProjectUpdateInput](docs/ProjectUpdateInput.md) + - [ProjectUsage](docs/ProjectUsage.md) + - [ProjectUsageList](docs/ProjectUsageList.md) + - [Raid](docs/Raid.md) + - [RecoveryCodeList](docs/RecoveryCodeList.md) + - [RequestIPReservation201Response](docs/RequestIPReservation201Response.md) + - [RequestIPReservationRequest](docs/RequestIPReservationRequest.md) + - [SSHKey](docs/SSHKey.md) + - [SSHKeyCreateInput](docs/SSHKeyCreateInput.md) + - [SSHKeyInput](docs/SSHKeyInput.md) + - [SSHKeyList](docs/SSHKeyList.md) + - [SelfServiceReservationItemRequest](docs/SelfServiceReservationItemRequest.md) + - [SelfServiceReservationItemResponse](docs/SelfServiceReservationItemResponse.md) + - [SelfServiceReservationList](docs/SelfServiceReservationList.md) + - [SelfServiceReservationResponse](docs/SelfServiceReservationResponse.md) + - [ServerInfo](docs/ServerInfo.md) + - [SpotMarketPricesList](docs/SpotMarketPricesList.md) + - [SpotMarketPricesPerMetroList](docs/SpotMarketPricesPerMetroList.md) + - [SpotMarketPricesPerMetroReport](docs/SpotMarketPricesPerMetroReport.md) + - [SpotMarketRequest](docs/SpotMarketRequest.md) + - [SpotMarketRequestCreateInput](docs/SpotMarketRequestCreateInput.md) + - [SpotMarketRequestCreateInputInstanceParameters](docs/SpotMarketRequestCreateInputInstanceParameters.md) + - [SpotMarketRequestList](docs/SpotMarketRequestList.md) + - [SpotMarketRequestMetro](docs/SpotMarketRequestMetro.md) + - [SpotPricesDatapoints](docs/SpotPricesDatapoints.md) + - [SpotPricesHistoryReport](docs/SpotPricesHistoryReport.md) + - [SpotPricesPerBaremetal](docs/SpotPricesPerBaremetal.md) + - [SpotPricesPerFacility](docs/SpotPricesPerFacility.md) + - [SpotPricesPerNewFacility](docs/SpotPricesPerNewFacility.md) + - [SpotPricesReport](docs/SpotPricesReport.md) + - [Storage](docs/Storage.md) + - [SupportRequestInput](docs/SupportRequestInput.md) + - [SupportRequestInputPriority](docs/SupportRequestInputPriority.md) + - [TransferRequest](docs/TransferRequest.md) + - [TransferRequestInput](docs/TransferRequestInput.md) + - [TransferRequestList](docs/TransferRequestList.md) + - [UpdateEmailInput](docs/UpdateEmailInput.md) + - [User](docs/User.md) + - [UserCreateInput](docs/UserCreateInput.md) + - [UserLimited](docs/UserLimited.md) + - [UserList](docs/UserList.md) + - [UserLite](docs/UserLite.md) + - [UserUpdateInput](docs/UserUpdateInput.md) + - [Userdata](docs/Userdata.md) + - [VerifyEmail](docs/VerifyEmail.md) + - [VirtualCircuit](docs/VirtualCircuit.md) + - [VirtualCircuitCreateInput](docs/VirtualCircuitCreateInput.md) + - [VirtualCircuitList](docs/VirtualCircuitList.md) + - [VirtualCircuitUpdateInput](docs/VirtualCircuitUpdateInput.md) + - [VirtualNetwork](docs/VirtualNetwork.md) + - [VirtualNetworkCreateInput](docs/VirtualNetworkCreateInput.md) + - [VirtualNetworkList](docs/VirtualNetworkList.md) + - [VlanFabricVcCreateInput](docs/VlanFabricVcCreateInput.md) + - [VlanFabricVcCreateInputServiceTokenType](docs/VlanFabricVcCreateInputServiceTokenType.md) + - [VlanFabricVcCreateInputType](docs/VlanFabricVcCreateInputType.md) + - [VlanVirtualCircuit](docs/VlanVirtualCircuit.md) + - [VlanVirtualCircuitBillType](docs/VlanVirtualCircuitBillType.md) + - [VlanVirtualCircuitCreateInput](docs/VlanVirtualCircuitCreateInput.md) + - [VlanVirtualCircuitStatus](docs/VlanVirtualCircuitStatus.md) + - [VlanVirtualCircuitType](docs/VlanVirtualCircuitType.md) + - [VlanVirtualCircuitUpdateInput](docs/VlanVirtualCircuitUpdateInput.md) + - [Vrf](docs/Vrf.md) + - [VrfCreateInput](docs/VrfCreateInput.md) + - [VrfFabricVcCreateInput](docs/VrfFabricVcCreateInput.md) + - [VrfIpReservation](docs/VrfIpReservation.md) + - [VrfIpReservationCreateInput](docs/VrfIpReservationCreateInput.md) + - [VrfIpReservationList](docs/VrfIpReservationList.md) + - [VrfIpReservationType](docs/VrfIpReservationType.md) + - [VrfList](docs/VrfList.md) + - [VrfMetalGateway](docs/VrfMetalGateway.md) + - [VrfMetalGatewayCreateInput](docs/VrfMetalGatewayCreateInput.md) + - [VrfRoute](docs/VrfRoute.md) + - [VrfRouteCreateInput](docs/VrfRouteCreateInput.md) + - [VrfRouteList](docs/VrfRouteList.md) + - [VrfRouteStatus](docs/VrfRouteStatus.md) + - [VrfRouteType](docs/VrfRouteType.md) + - [VrfRouteUpdateInput](docs/VrfRouteUpdateInput.md) + - [VrfUpdateInput](docs/VrfUpdateInput.md) + - [VrfVirtualCircuit](docs/VrfVirtualCircuit.md) + - [VrfVirtualCircuitCreateInput](docs/VrfVirtualCircuitCreateInput.md) + - [VrfVirtualCircuitStatus](docs/VrfVirtualCircuitStatus.md) + - [VrfVirtualCircuitUpdateInput](docs/VrfVirtualCircuitUpdateInput.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### x_auth_token + +- **Type**: API key +- **API key parameter name**: X-Auth-Token +- **Location**: HTTP header + +Note, each API key must be added to a map of `map[string]APIKey` where the key is: X-Auth-Token and passed in as the auth context for each request. + +Example + +```go +auth := context.WithValue( + context.Background(), + metalv1.ContextAPIKeys, + map[string]metalv1.APIKey{ + "X-Auth-Token": {Key: "API_KEY_STRING"}, + }, + ) +r, err := client.Service.Operation(auth, args) +``` + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + +support@equinixmetal.com + diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_authentication.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_authentication.go new file mode 100644 index 00000000..35c777e1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_authentication.go @@ -0,0 +1,922 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// AuthenticationApiService AuthenticationApi service +type AuthenticationApiService service + +type ApiCreateAPIKeyRequest struct { + ctx context.Context + ApiService *AuthenticationApiService + authTokenInput *AuthTokenInput + include *[]string +} + +// API key to create +func (r ApiCreateAPIKeyRequest) AuthTokenInput(authTokenInput AuthTokenInput) ApiCreateAPIKeyRequest { + r.authTokenInput = &authTokenInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateAPIKeyRequest) Include(include []string) ApiCreateAPIKeyRequest { + r.include = &include + return r +} + +func (r ApiCreateAPIKeyRequest) Execute() (*AuthToken, *http.Response, error) { + return r.ApiService.CreateAPIKeyExecute(r) +} + +/* +CreateAPIKey Create an API key + +Creates a API key for the current user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateAPIKeyRequest +*/ +func (a *AuthenticationApiService) CreateAPIKey(ctx context.Context) ApiCreateAPIKeyRequest { + return ApiCreateAPIKeyRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return AuthToken +func (a *AuthenticationApiService) CreateAPIKeyExecute(r ApiCreateAPIKeyRequest) (*AuthToken, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AuthToken + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthenticationApiService.CreateAPIKey") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/api-keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.authTokenInput == nil { + return localVarReturnValue, nil, reportError("authTokenInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.authTokenInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateProjectAPIKeyRequest struct { + ctx context.Context + ApiService *AuthenticationApiService + id string + authTokenInput *AuthTokenInput + include *[]string +} + +// API Key to create +func (r ApiCreateProjectAPIKeyRequest) AuthTokenInput(authTokenInput AuthTokenInput) ApiCreateProjectAPIKeyRequest { + r.authTokenInput = &authTokenInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateProjectAPIKeyRequest) Include(include []string) ApiCreateProjectAPIKeyRequest { + r.include = &include + return r +} + +func (r ApiCreateProjectAPIKeyRequest) Execute() (*AuthToken, *http.Response, error) { + return r.ApiService.CreateProjectAPIKeyExecute(r) +} + +/* +CreateProjectAPIKey Create an API key for a project. + +Creates an API key for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiCreateProjectAPIKeyRequest +*/ +func (a *AuthenticationApiService) CreateProjectAPIKey(ctx context.Context, id string) ApiCreateProjectAPIKeyRequest { + return ApiCreateProjectAPIKeyRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return AuthToken +func (a *AuthenticationApiService) CreateProjectAPIKeyExecute(r ApiCreateProjectAPIKeyRequest) (*AuthToken, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AuthToken + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthenticationApiService.CreateProjectAPIKey") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/api-keys" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.authTokenInput == nil { + return localVarReturnValue, nil, reportError("authTokenInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.authTokenInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteAPIKeyRequest struct { + ctx context.Context + ApiService *AuthenticationApiService + id string +} + +func (r ApiDeleteAPIKeyRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteAPIKeyExecute(r) +} + +/* +DeleteAPIKey Delete the API key + +Deletes the API key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id API Key UUID + @return ApiDeleteAPIKeyRequest +*/ +func (a *AuthenticationApiService) DeleteAPIKey(ctx context.Context, id string) ApiDeleteAPIKeyRequest { + return ApiDeleteAPIKeyRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *AuthenticationApiService) DeleteAPIKeyExecute(r ApiDeleteAPIKeyRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthenticationApiService.DeleteAPIKey") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api-keys/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteUserAPIKeyRequest struct { + ctx context.Context + ApiService *AuthenticationApiService + id string +} + +func (r ApiDeleteUserAPIKeyRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteUserAPIKeyExecute(r) +} + +/* +DeleteUserAPIKey Delete the API key + +Deletes the current user API key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id API Key UUID + @return ApiDeleteUserAPIKeyRequest +*/ +func (a *AuthenticationApiService) DeleteUserAPIKey(ctx context.Context, id string) ApiDeleteUserAPIKeyRequest { + return ApiDeleteUserAPIKeyRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *AuthenticationApiService) DeleteUserAPIKeyExecute(r ApiDeleteUserAPIKeyRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthenticationApiService.DeleteUserAPIKey") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/api-keys/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindAPIKeysRequest struct { + ctx context.Context + ApiService *AuthenticationApiService + search *string + include *[]string +} + +// Search by description +func (r ApiFindAPIKeysRequest) Search(search string) ApiFindAPIKeysRequest { + r.search = &search + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindAPIKeysRequest) Include(include []string) ApiFindAPIKeysRequest { + r.include = &include + return r +} + +func (r ApiFindAPIKeysRequest) Execute() (*AuthTokenList, *http.Response, error) { + return r.ApiService.FindAPIKeysExecute(r) +} + +/* +FindAPIKeys Retrieve all user API keys + +Returns all API keys for the current user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindAPIKeysRequest +*/ +func (a *AuthenticationApiService) FindAPIKeys(ctx context.Context) ApiFindAPIKeysRequest { + return ApiFindAPIKeysRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return AuthTokenList +func (a *AuthenticationApiService) FindAPIKeysExecute(r ApiFindAPIKeysRequest) (*AuthTokenList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AuthTokenList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthenticationApiService.FindAPIKeys") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/api-keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.search != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindProjectAPIKeysRequest struct { + ctx context.Context + ApiService *AuthenticationApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindProjectAPIKeysRequest) Include(include []string) ApiFindProjectAPIKeysRequest { + r.include = &include + return r +} + +func (r ApiFindProjectAPIKeysRequest) Execute() (*AuthTokenList, *http.Response, error) { + return r.ApiService.FindProjectAPIKeysExecute(r) +} + +/* +FindProjectAPIKeys Retrieve all API keys for the project. + +Returns all API keys for a specific project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindProjectAPIKeysRequest +*/ +func (a *AuthenticationApiService) FindProjectAPIKeys(ctx context.Context, id string) ApiFindProjectAPIKeysRequest { + return ApiFindProjectAPIKeysRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return AuthTokenList +func (a *AuthenticationApiService) FindProjectAPIKeysExecute(r ApiFindProjectAPIKeysRequest) (*AuthTokenList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AuthTokenList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthenticationApiService.FindProjectAPIKeys") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/api-keys" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_batches.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_batches.go new file mode 100644 index 00000000..ec17ec91 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_batches.go @@ -0,0 +1,643 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// BatchesApiService BatchesApi service +type BatchesApiService service + +type ApiCreateDeviceBatchRequest struct { + ctx context.Context + ApiService *BatchesApiService + id string + instancesBatchCreateInput *InstancesBatchCreateInput +} + +// Batches to create +func (r ApiCreateDeviceBatchRequest) InstancesBatchCreateInput(instancesBatchCreateInput InstancesBatchCreateInput) ApiCreateDeviceBatchRequest { + r.instancesBatchCreateInput = &instancesBatchCreateInput + return r +} + +func (r ApiCreateDeviceBatchRequest) Execute() (*BatchesList, *http.Response, error) { + return r.ApiService.CreateDeviceBatchExecute(r) +} + +/* +CreateDeviceBatch Create a devices batch + +Creates new devices in batch and provisions them in our datacenter. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiCreateDeviceBatchRequest +*/ +func (a *BatchesApiService) CreateDeviceBatch(ctx context.Context, id string) ApiCreateDeviceBatchRequest { + return ApiCreateDeviceBatchRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BatchesList +func (a *BatchesApiService) CreateDeviceBatchExecute(r ApiCreateDeviceBatchRequest) (*BatchesList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BatchesList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BatchesApiService.CreateDeviceBatch") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/devices/batch" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.instancesBatchCreateInput == nil { + return localVarReturnValue, nil, reportError("instancesBatchCreateInput is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.instancesBatchCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteBatchRequest struct { + ctx context.Context + ApiService *BatchesApiService + id string + removeAssociatedInstances *bool +} + +// Delete all instances created from this batch +func (r ApiDeleteBatchRequest) RemoveAssociatedInstances(removeAssociatedInstances bool) ApiDeleteBatchRequest { + r.removeAssociatedInstances = &removeAssociatedInstances + return r +} + +func (r ApiDeleteBatchRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteBatchExecute(r) +} + +/* +DeleteBatch Delete the Batch + +Deletes the Batch. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Batch UUID + @return ApiDeleteBatchRequest +*/ +func (a *BatchesApiService) DeleteBatch(ctx context.Context, id string) ApiDeleteBatchRequest { + return ApiDeleteBatchRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *BatchesApiService) DeleteBatchExecute(r ApiDeleteBatchRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BatchesApiService.DeleteBatch") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/batches/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.removeAssociatedInstances != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "remove_associated_instances", r.removeAssociatedInstances, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindBatchByIdRequest struct { + ctx context.Context + ApiService *BatchesApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindBatchByIdRequest) Include(include []string) ApiFindBatchByIdRequest { + r.include = &include + return r +} + +func (r ApiFindBatchByIdRequest) Execute() (*Batch, *http.Response, error) { + return r.ApiService.FindBatchByIdExecute(r) +} + +/* +FindBatchById Retrieve a Batch + +Returns a Batch + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Batch UUID + @return ApiFindBatchByIdRequest +*/ +func (a *BatchesApiService) FindBatchById(ctx context.Context, id string) ApiFindBatchByIdRequest { + return ApiFindBatchByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Batch +func (a *BatchesApiService) FindBatchByIdExecute(r ApiFindBatchByIdRequest) (*Batch, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Batch + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BatchesApiService.FindBatchById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/batches/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindBatchesByProjectRequest struct { + ctx context.Context + ApiService *BatchesApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindBatchesByProjectRequest) Include(include []string) ApiFindBatchesByProjectRequest { + r.include = &include + return r +} + +func (r ApiFindBatchesByProjectRequest) Execute() (*BatchesList, *http.Response, error) { + return r.ApiService.FindBatchesByProjectExecute(r) +} + +/* +FindBatchesByProject Retrieve all batches by project + +Returns all batches for the given project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindBatchesByProjectRequest +*/ +func (a *BatchesApiService) FindBatchesByProject(ctx context.Context, id string) ApiFindBatchesByProjectRequest { + return ApiFindBatchesByProjectRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BatchesList +func (a *BatchesApiService) FindBatchesByProjectExecute(r ApiFindBatchesByProjectRequest) (*BatchesList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BatchesList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BatchesApiService.FindBatchesByProject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/batches" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_bgp.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_bgp.go new file mode 100644 index 00000000..681eb13d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_bgp.go @@ -0,0 +1,1103 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// BGPApiService BGPApi service +type BGPApiService service + +type ApiDeleteBgpSessionRequest struct { + ctx context.Context + ApiService *BGPApiService + id string +} + +func (r ApiDeleteBgpSessionRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteBgpSessionExecute(r) +} + +/* +DeleteBgpSession Delete the BGP session + +Deletes the BGP session. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id BGP session UUID + @return ApiDeleteBgpSessionRequest +*/ +func (a *BGPApiService) DeleteBgpSession(ctx context.Context, id string) ApiDeleteBgpSessionRequest { + return ApiDeleteBgpSessionRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *BGPApiService) DeleteBgpSessionExecute(r ApiDeleteBgpSessionRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BGPApiService.DeleteBgpSession") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/bgp/sessions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindBgpConfigByProjectRequest struct { + ctx context.Context + ApiService *BGPApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindBgpConfigByProjectRequest) Include(include []string) ApiFindBgpConfigByProjectRequest { + r.include = &include + return r +} + +func (r ApiFindBgpConfigByProjectRequest) Execute() (*BgpConfig, *http.Response, error) { + return r.ApiService.FindBgpConfigByProjectExecute(r) +} + +/* +FindBgpConfigByProject Retrieve a bgp config + +Returns a bgp config + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindBgpConfigByProjectRequest +*/ +func (a *BGPApiService) FindBgpConfigByProject(ctx context.Context, id string) ApiFindBgpConfigByProjectRequest { + return ApiFindBgpConfigByProjectRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BgpConfig +func (a *BGPApiService) FindBgpConfigByProjectExecute(r ApiFindBgpConfigByProjectRequest) (*BgpConfig, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BgpConfig + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BGPApiService.FindBgpConfigByProject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/bgp-config" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindBgpSessionByIdRequest struct { + ctx context.Context + ApiService *BGPApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindBgpSessionByIdRequest) Include(include []string) ApiFindBgpSessionByIdRequest { + r.include = &include + return r +} + +func (r ApiFindBgpSessionByIdRequest) Execute() (*BgpSession, *http.Response, error) { + return r.ApiService.FindBgpSessionByIdExecute(r) +} + +/* +FindBgpSessionById Retrieve a BGP session + +Returns a BGP session + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id BGP session UUID + @return ApiFindBgpSessionByIdRequest +*/ +func (a *BGPApiService) FindBgpSessionById(ctx context.Context, id string) ApiFindBgpSessionByIdRequest { + return ApiFindBgpSessionByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BgpSession +func (a *BGPApiService) FindBgpSessionByIdExecute(r ApiFindBgpSessionByIdRequest) (*BgpSession, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BgpSession + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BGPApiService.FindBgpSessionById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/bgp/sessions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindGlobalBgpRangesRequest struct { + ctx context.Context + ApiService *BGPApiService + id string +} + +func (r ApiFindGlobalBgpRangesRequest) Execute() (*GlobalBgpRangeList, *http.Response, error) { + return r.ApiService.FindGlobalBgpRangesExecute(r) +} + +/* +FindGlobalBgpRanges Retrieve all global bgp ranges + +Returns all global bgp ranges for a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindGlobalBgpRangesRequest +*/ +func (a *BGPApiService) FindGlobalBgpRanges(ctx context.Context, id string) ApiFindGlobalBgpRangesRequest { + return ApiFindGlobalBgpRangesRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return GlobalBgpRangeList +func (a *BGPApiService) FindGlobalBgpRangesExecute(r ApiFindGlobalBgpRangesRequest) (*GlobalBgpRangeList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GlobalBgpRangeList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BGPApiService.FindGlobalBgpRanges") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/global-bgp-ranges" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindProjectBgpSessionsRequest struct { + ctx context.Context + ApiService *BGPApiService + id string +} + +func (r ApiFindProjectBgpSessionsRequest) Execute() (*BgpSessionList, *http.Response, error) { + return r.ApiService.FindProjectBgpSessionsExecute(r) +} + +/* +FindProjectBgpSessions Retrieve all BGP sessions for project + +Provides a listing of available BGP sessions for the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindProjectBgpSessionsRequest +*/ +func (a *BGPApiService) FindProjectBgpSessions(ctx context.Context, id string) ApiFindProjectBgpSessionsRequest { + return ApiFindProjectBgpSessionsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BgpSessionList +func (a *BGPApiService) FindProjectBgpSessionsExecute(r ApiFindProjectBgpSessionsRequest) (*BgpSessionList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BgpSessionList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BGPApiService.FindProjectBgpSessions") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/bgp/sessions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiRequestBgpConfigRequest struct { + ctx context.Context + ApiService *BGPApiService + id string + bgpConfigRequestInput *BgpConfigRequestInput + include *[]string +} + +// BGP config Request to create +func (r ApiRequestBgpConfigRequest) BgpConfigRequestInput(bgpConfigRequestInput BgpConfigRequestInput) ApiRequestBgpConfigRequest { + r.bgpConfigRequestInput = &bgpConfigRequestInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiRequestBgpConfigRequest) Include(include []string) ApiRequestBgpConfigRequest { + r.include = &include + return r +} + +func (r ApiRequestBgpConfigRequest) Execute() (*http.Response, error) { + return r.ApiService.RequestBgpConfigExecute(r) +} + +/* +RequestBgpConfig Requesting bgp config + +Requests to enable bgp configuration for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiRequestBgpConfigRequest +*/ +func (a *BGPApiService) RequestBgpConfig(ctx context.Context, id string) ApiRequestBgpConfigRequest { + return ApiRequestBgpConfigRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *BGPApiService) RequestBgpConfigExecute(r ApiRequestBgpConfigRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BGPApiService.RequestBgpConfig") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/bgp-configs" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.bgpConfigRequestInput == nil { + return nil, reportError("bgpConfigRequestInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.bgpConfigRequestInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiUpdateBgpSessionRequest struct { + ctx context.Context + ApiService *BGPApiService + id string + body *bool +} + +// Default route +func (r ApiUpdateBgpSessionRequest) Body(body bool) ApiUpdateBgpSessionRequest { + r.body = &body + return r +} + +func (r ApiUpdateBgpSessionRequest) Execute() (*http.Response, error) { + return r.ApiService.UpdateBgpSessionExecute(r) +} + +/* +UpdateBgpSession Update the BGP session + +Updates the BGP session by either enabling or disabling the default route functionality. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id BGP session UUID + @return ApiUpdateBgpSessionRequest +*/ +func (a *BGPApiService) UpdateBgpSession(ctx context.Context, id string) ApiUpdateBgpSessionRequest { + return ApiUpdateBgpSessionRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *BGPApiService) UpdateBgpSessionExecute(r ApiUpdateBgpSessionRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BGPApiService.UpdateBgpSession") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/bgp/sessions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.body == nil { + return nil, reportError("body is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_capacity.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_capacity.go new file mode 100644 index 00000000..441e86eb --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_capacity.go @@ -0,0 +1,848 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// CapacityApiService CapacityApi service +type CapacityApiService service + +type ApiCheckCapacityForFacilityRequest struct { + ctx context.Context + ApiService *CapacityApiService + capacityInput *CapacityInput +} + +// Facility to check capacity in +func (r ApiCheckCapacityForFacilityRequest) CapacityInput(capacityInput CapacityInput) ApiCheckCapacityForFacilityRequest { + r.capacityInput = &capacityInput + return r +} + +func (r ApiCheckCapacityForFacilityRequest) Execute() (*CapacityCheckPerFacilityList, *http.Response, error) { + return r.ApiService.CheckCapacityForFacilityExecute(r) +} + +/* +CheckCapacityForFacility Check capacity + +Validates if a deploy can be fulfilled. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCheckCapacityForFacilityRequest + +Deprecated +*/ +func (a *CapacityApiService) CheckCapacityForFacility(ctx context.Context) ApiCheckCapacityForFacilityRequest { + return ApiCheckCapacityForFacilityRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CapacityCheckPerFacilityList +// +// Deprecated +func (a *CapacityApiService) CheckCapacityForFacilityExecute(r ApiCheckCapacityForFacilityRequest) (*CapacityCheckPerFacilityList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CapacityCheckPerFacilityList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CapacityApiService.CheckCapacityForFacility") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/capacity" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.capacityInput == nil { + return localVarReturnValue, nil, reportError("capacityInput is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.capacityInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCheckCapacityForMetroRequest struct { + ctx context.Context + ApiService *CapacityApiService + capacityInput *CapacityInput +} + +// Metro to check capacity in +func (r ApiCheckCapacityForMetroRequest) CapacityInput(capacityInput CapacityInput) ApiCheckCapacityForMetroRequest { + r.capacityInput = &capacityInput + return r +} + +func (r ApiCheckCapacityForMetroRequest) Execute() (*CapacityCheckPerMetroList, *http.Response, error) { + return r.ApiService.CheckCapacityForMetroExecute(r) +} + +/* +CheckCapacityForMetro Check capacity for a metro + +Validates if a deploy can be fulfilled in a metro. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCheckCapacityForMetroRequest +*/ +func (a *CapacityApiService) CheckCapacityForMetro(ctx context.Context) ApiCheckCapacityForMetroRequest { + return ApiCheckCapacityForMetroRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CapacityCheckPerMetroList +func (a *CapacityApiService) CheckCapacityForMetroExecute(r ApiCheckCapacityForMetroRequest) (*CapacityCheckPerMetroList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CapacityCheckPerMetroList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CapacityApiService.CheckCapacityForMetro") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/capacity/metros" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.capacityInput == nil { + return localVarReturnValue, nil, reportError("capacityInput is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.capacityInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindCapacityForFacilityRequest struct { + ctx context.Context + ApiService *CapacityApiService +} + +func (r ApiFindCapacityForFacilityRequest) Execute() (*CapacityList, *http.Response, error) { + return r.ApiService.FindCapacityForFacilityExecute(r) +} + +/* +FindCapacityForFacility View capacity + +Returns a list of facilities and plans with their current capacity. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindCapacityForFacilityRequest +*/ +func (a *CapacityApiService) FindCapacityForFacility(ctx context.Context) ApiFindCapacityForFacilityRequest { + return ApiFindCapacityForFacilityRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CapacityList +func (a *CapacityApiService) FindCapacityForFacilityExecute(r ApiFindCapacityForFacilityRequest) (*CapacityList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CapacityList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CapacityApiService.FindCapacityForFacility") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/capacity" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindCapacityForMetroRequest struct { + ctx context.Context + ApiService *CapacityApiService +} + +func (r ApiFindCapacityForMetroRequest) Execute() (*CapacityList, *http.Response, error) { + return r.ApiService.FindCapacityForMetroExecute(r) +} + +/* +FindCapacityForMetro View capacity for metros + +Returns a list of metros and plans with their current capacity. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindCapacityForMetroRequest +*/ +func (a *CapacityApiService) FindCapacityForMetro(ctx context.Context) ApiFindCapacityForMetroRequest { + return ApiFindCapacityForMetroRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CapacityList +func (a *CapacityApiService) FindCapacityForMetroExecute(r ApiFindCapacityForMetroRequest) (*CapacityList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CapacityList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CapacityApiService.FindCapacityForMetro") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/capacity/metros" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindOrganizationCapacityPerFacilityRequest struct { + ctx context.Context + ApiService *CapacityApiService + id string +} + +func (r ApiFindOrganizationCapacityPerFacilityRequest) Execute() (*CapacityList, *http.Response, error) { + return r.ApiService.FindOrganizationCapacityPerFacilityExecute(r) +} + +/* +FindOrganizationCapacityPerFacility View available hardware plans per Facility for given organization + +Returns a list of facilities and plans with their current capacity. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOrganizationCapacityPerFacilityRequest +*/ +func (a *CapacityApiService) FindOrganizationCapacityPerFacility(ctx context.Context, id string) ApiFindOrganizationCapacityPerFacilityRequest { + return ApiFindOrganizationCapacityPerFacilityRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return CapacityList +func (a *CapacityApiService) FindOrganizationCapacityPerFacilityExecute(r ApiFindOrganizationCapacityPerFacilityRequest) (*CapacityList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CapacityList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CapacityApiService.FindOrganizationCapacityPerFacility") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/capacity" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindOrganizationCapacityPerMetroRequest struct { + ctx context.Context + ApiService *CapacityApiService + id string +} + +func (r ApiFindOrganizationCapacityPerMetroRequest) Execute() (*CapacityList, *http.Response, error) { + return r.ApiService.FindOrganizationCapacityPerMetroExecute(r) +} + +/* +FindOrganizationCapacityPerMetro View available hardware plans per Metro for given organization + +Returns a list of metros and plans with their current capacity. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOrganizationCapacityPerMetroRequest +*/ +func (a *CapacityApiService) FindOrganizationCapacityPerMetro(ctx context.Context, id string) ApiFindOrganizationCapacityPerMetroRequest { + return ApiFindOrganizationCapacityPerMetroRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return CapacityList +func (a *CapacityApiService) FindOrganizationCapacityPerMetroExecute(r ApiFindOrganizationCapacityPerMetroRequest) (*CapacityList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CapacityList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CapacityApiService.FindOrganizationCapacityPerMetro") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/capacity/metros" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_console_log_details.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_console_log_details.go new file mode 100644 index 00000000..a12edeb4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_console_log_details.go @@ -0,0 +1,175 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "os" + "strings" +) + +// ConsoleLogDetailsApiService ConsoleLogDetailsApi service +type ConsoleLogDetailsApiService service + +type ApiCaptureScreenshotRequest struct { + ctx context.Context + ApiService *ConsoleLogDetailsApiService + id string +} + +func (r ApiCaptureScreenshotRequest) Execute() (*os.File, *http.Response, error) { + return r.ApiService.CaptureScreenshotExecute(r) +} + +/* +CaptureScreenshot Method for CaptureScreenshot + +Capture a screenshot from the device, if supported, via the BMC. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiCaptureScreenshotRequest +*/ +func (a *ConsoleLogDetailsApiService) CaptureScreenshot(ctx context.Context, id string) ApiCaptureScreenshotRequest { + return ApiCaptureScreenshotRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return *os.File +func (a *ConsoleLogDetailsApiService) CaptureScreenshotExecute(r ApiCaptureScreenshotRequest) (*os.File, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *os.File + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConsoleLogDetailsApiService.CaptureScreenshot") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/diagnostics/screenshot" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/jpeg", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_devices.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_devices.go new file mode 100644 index 00000000..0451d292 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_devices.go @@ -0,0 +1,3498 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// DevicesApiService DevicesApi service +type DevicesApiService service + +type ApiCreateBgpSessionRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + bGPSessionInput *BGPSessionInput + include *[]string +} + +// BGP session to create +func (r ApiCreateBgpSessionRequest) BGPSessionInput(bGPSessionInput BGPSessionInput) ApiCreateBgpSessionRequest { + r.bGPSessionInput = &bGPSessionInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateBgpSessionRequest) Include(include []string) ApiCreateBgpSessionRequest { + r.include = &include + return r +} + +func (r ApiCreateBgpSessionRequest) Execute() (*BgpSession, *http.Response, error) { + return r.ApiService.CreateBgpSessionExecute(r) +} + +/* +CreateBgpSession Create a BGP session + +Creates a BGP session. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiCreateBgpSessionRequest +*/ +func (a *DevicesApiService) CreateBgpSession(ctx context.Context, id string) ApiCreateBgpSessionRequest { + return ApiCreateBgpSessionRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BgpSession +func (a *DevicesApiService) CreateBgpSessionExecute(r ApiCreateBgpSessionRequest) (*BgpSession, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BgpSession + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.CreateBgpSession") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/bgp/sessions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.bGPSessionInput == nil { + return localVarReturnValue, nil, reportError("bGPSessionInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.bGPSessionInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateDeviceRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + createDeviceRequest *CreateDeviceRequest + include *[]string + exclude *[]string +} + +// Device to create +func (r ApiCreateDeviceRequest) CreateDeviceRequest(createDeviceRequest CreateDeviceRequest) ApiCreateDeviceRequest { + r.createDeviceRequest = &createDeviceRequest + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateDeviceRequest) Include(include []string) ApiCreateDeviceRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateDeviceRequest) Exclude(exclude []string) ApiCreateDeviceRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateDeviceRequest) Execute() (*Device, *http.Response, error) { + return r.ApiService.CreateDeviceExecute(r) +} + +/* +CreateDevice Create a device + +Creates a new device and provisions it in the specified location. + +Device type-specific options are accepted. For example, `baremetal` devices accept `operating_system`, `hostname`, and `plan`. These parameters may not be accepted for other device types. The default device type is `baremetal`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiCreateDeviceRequest +*/ +func (a *DevicesApiService) CreateDevice(ctx context.Context, id string) ApiCreateDeviceRequest { + return ApiCreateDeviceRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Device +func (a *DevicesApiService) CreateDeviceExecute(r ApiCreateDeviceRequest) (*Device, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Device + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.CreateDevice") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/devices" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createDeviceRequest == nil { + return localVarReturnValue, nil, reportError("createDeviceRequest is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createDeviceRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateIPAssignmentRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + iPAssignmentInput *IPAssignmentInput + include *[]string + exclude *[]string +} + +// IPAssignment to create +func (r ApiCreateIPAssignmentRequest) IPAssignmentInput(iPAssignmentInput IPAssignmentInput) ApiCreateIPAssignmentRequest { + r.iPAssignmentInput = &iPAssignmentInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateIPAssignmentRequest) Include(include []string) ApiCreateIPAssignmentRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateIPAssignmentRequest) Exclude(exclude []string) ApiCreateIPAssignmentRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateIPAssignmentRequest) Execute() (*IPAssignment, *http.Response, error) { + return r.ApiService.CreateIPAssignmentExecute(r) +} + +/* +CreateIPAssignment Create an ip assignment + +Creates an ip assignment for a device. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiCreateIPAssignmentRequest +*/ +func (a *DevicesApiService) CreateIPAssignment(ctx context.Context, id string) ApiCreateIPAssignmentRequest { + return ApiCreateIPAssignmentRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return IPAssignment +func (a *DevicesApiService) CreateIPAssignmentExecute(r ApiCreateIPAssignmentRequest) (*IPAssignment, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IPAssignment + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.CreateIPAssignment") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/ips" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.iPAssignmentInput == nil { + return localVarReturnValue, nil, reportError("iPAssignmentInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.iPAssignmentInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteDeviceRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + forceDelete *bool +} + +// Force the deletion of the device, by detaching any storage volume still active. +func (r ApiDeleteDeviceRequest) ForceDelete(forceDelete bool) ApiDeleteDeviceRequest { + r.forceDelete = &forceDelete + return r +} + +func (r ApiDeleteDeviceRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteDeviceExecute(r) +} + +/* +DeleteDevice Delete the device + +Deletes a device and deprovisions it in our datacenter. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiDeleteDeviceRequest +*/ +func (a *DevicesApiService) DeleteDevice(ctx context.Context, id string) ApiDeleteDeviceRequest { + return ApiDeleteDeviceRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DevicesApiService) DeleteDeviceExecute(r ApiDeleteDeviceRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.DeleteDevice") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.forceDelete != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "force_delete", r.forceDelete, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindBgpSessionsRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindBgpSessionsRequest) Include(include []string) ApiFindBgpSessionsRequest { + r.include = &include + return r +} + +func (r ApiFindBgpSessionsRequest) Execute() (*BgpSessionList, *http.Response, error) { + return r.ApiService.FindBgpSessionsExecute(r) +} + +/* +FindBgpSessions Retrieve all BGP sessions + +Provides a listing of available BGP sessions for the device. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiFindBgpSessionsRequest +*/ +func (a *DevicesApiService) FindBgpSessions(ctx context.Context, id string) ApiFindBgpSessionsRequest { + return ApiFindBgpSessionsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BgpSessionList +func (a *DevicesApiService) FindBgpSessionsExecute(r ApiFindBgpSessionsRequest) (*BgpSessionList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BgpSessionList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.FindBgpSessions") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/bgp/sessions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindDeviceByIdRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindDeviceByIdRequest) Include(include []string) ApiFindDeviceByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindDeviceByIdRequest) Exclude(exclude []string) ApiFindDeviceByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindDeviceByIdRequest) Execute() (*Device, *http.Response, error) { + return r.ApiService.FindDeviceByIdExecute(r) +} + +/* +FindDeviceById Retrieve a device + +Type-specific options (such as facility for baremetal devices) will be included as part of the main data structure. + + State value can be one of: active inactive queued or provisioning + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiFindDeviceByIdRequest +*/ +func (a *DevicesApiService) FindDeviceById(ctx context.Context, id string) ApiFindDeviceByIdRequest { + return ApiFindDeviceByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Device +func (a *DevicesApiService) FindDeviceByIdExecute(r ApiFindDeviceByIdRequest) (*Device, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Device + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.FindDeviceById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindDeviceCustomdataRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string +} + +func (r ApiFindDeviceCustomdataRequest) Execute() (*http.Response, error) { + return r.ApiService.FindDeviceCustomdataExecute(r) +} + +/* +FindDeviceCustomdata Retrieve the custom metadata of an instance + +Provides the custom metadata stored for this instance in json format + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Instance UUID + @return ApiFindDeviceCustomdataRequest +*/ +func (a *DevicesApiService) FindDeviceCustomdata(ctx context.Context, id string) ApiFindDeviceCustomdataRequest { + return ApiFindDeviceCustomdataRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DevicesApiService) FindDeviceCustomdataExecute(r ApiFindDeviceCustomdataRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.FindDeviceCustomdata") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/customdata" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindDeviceMetadataByIDRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string +} + +func (r ApiFindDeviceMetadataByIDRequest) Execute() (*Metadata, *http.Response, error) { + return r.ApiService.FindDeviceMetadataByIDExecute(r) +} + +/* +FindDeviceMetadataByID Retrieve metadata + +Retrieve device metadata + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiFindDeviceMetadataByIDRequest +*/ +func (a *DevicesApiService) FindDeviceMetadataByID(ctx context.Context, id string) ApiFindDeviceMetadataByIDRequest { + return ApiFindDeviceMetadataByIDRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Metadata +func (a *DevicesApiService) FindDeviceMetadataByIDExecute(r ApiFindDeviceMetadataByIDRequest) (*Metadata, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Metadata + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.FindDeviceMetadataByID") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/metadata" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindDeviceUserdataByIDRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string +} + +func (r ApiFindDeviceUserdataByIDRequest) Execute() (*Userdata, *http.Response, error) { + return r.ApiService.FindDeviceUserdataByIDExecute(r) +} + +/* +FindDeviceUserdataByID Retrieve userdata + +Retrieve device userdata + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiFindDeviceUserdataByIDRequest +*/ +func (a *DevicesApiService) FindDeviceUserdataByID(ctx context.Context, id string) ApiFindDeviceUserdataByIDRequest { + return ApiFindDeviceUserdataByIDRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Userdata +func (a *DevicesApiService) FindDeviceUserdataByIDExecute(r ApiFindDeviceUserdataByIDRequest) (*Userdata, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Userdata + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.FindDeviceUserdataByID") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/userdata" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindIPAssignmentCustomdataRequest struct { + ctx context.Context + ApiService *DevicesApiService + instanceId string + id string +} + +func (r ApiFindIPAssignmentCustomdataRequest) Execute() (*http.Response, error) { + return r.ApiService.FindIPAssignmentCustomdataExecute(r) +} + +/* +FindIPAssignmentCustomdata Retrieve the custom metadata of an IP Assignment + +Provides the custom metadata stored for this IP Assignment in json format + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param instanceId Instance UUID + @param id Ip Assignment UUID + @return ApiFindIPAssignmentCustomdataRequest +*/ +func (a *DevicesApiService) FindIPAssignmentCustomdata(ctx context.Context, instanceId string, id string) ApiFindIPAssignmentCustomdataRequest { + return ApiFindIPAssignmentCustomdataRequest{ + ApiService: a, + ctx: ctx, + instanceId: instanceId, + id: id, + } +} + +// Execute executes the request +func (a *DevicesApiService) FindIPAssignmentCustomdataExecute(r ApiFindIPAssignmentCustomdataRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.FindIPAssignmentCustomdata") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{instance_id}/ips/{id}/customdata" + localVarPath = strings.Replace(localVarPath, "{"+"instance_id"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindIPAssignmentsRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindIPAssignmentsRequest) Include(include []string) ApiFindIPAssignmentsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindIPAssignmentsRequest) Exclude(exclude []string) ApiFindIPAssignmentsRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindIPAssignmentsRequest) Execute() (*IPAssignmentList, *http.Response, error) { + return r.ApiService.FindIPAssignmentsExecute(r) +} + +/* +FindIPAssignments Retrieve all ip assignments + +Returns all ip assignments for a device. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiFindIPAssignmentsRequest +*/ +func (a *DevicesApiService) FindIPAssignments(ctx context.Context, id string) ApiFindIPAssignmentsRequest { + return ApiFindIPAssignmentsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return IPAssignmentList +func (a *DevicesApiService) FindIPAssignmentsExecute(r ApiFindIPAssignmentsRequest) (*IPAssignmentList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IPAssignmentList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.FindIPAssignments") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/ips" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindInstanceBandwidthRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + from *string + until *string +} + +// Timestamp from range +func (r ApiFindInstanceBandwidthRequest) From(from string) ApiFindInstanceBandwidthRequest { + r.from = &from + return r +} + +// Timestamp to range +func (r ApiFindInstanceBandwidthRequest) Until(until string) ApiFindInstanceBandwidthRequest { + r.until = &until + return r +} + +func (r ApiFindInstanceBandwidthRequest) Execute() (*http.Response, error) { + return r.ApiService.FindInstanceBandwidthExecute(r) +} + +/* +FindInstanceBandwidth Retrieve an instance bandwidth + +Retrieve an instance bandwidth for a given period of time. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiFindInstanceBandwidthRequest +*/ +func (a *DevicesApiService) FindInstanceBandwidth(ctx context.Context, id string) ApiFindInstanceBandwidthRequest { + return ApiFindInstanceBandwidthRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DevicesApiService) FindInstanceBandwidthExecute(r ApiFindInstanceBandwidthRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.FindInstanceBandwidth") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/bandwidth" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.from == nil { + return nil, reportError("from is required and must be specified") + } + if r.until == nil { + return nil, reportError("until is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "until", r.until, "") + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindOrganizationDevicesRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + search *string + categories *[]FindOrganizationDevicesCategoriesParameterInner + facility *string + hostname *string + reserved *bool + tag *string + type_ *string + hasTerminationTime *bool + macAddress *string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses. +func (r ApiFindOrganizationDevicesRequest) Search(search string) ApiFindOrganizationDevicesRequest { + r.search = &search + return r +} + +// Filter by plan category +func (r ApiFindOrganizationDevicesRequest) Categories(categories []FindOrganizationDevicesCategoriesParameterInner) ApiFindOrganizationDevicesRequest { + r.categories = &categories + return r +} + +// Filter by device facility +func (r ApiFindOrganizationDevicesRequest) Facility(facility string) ApiFindOrganizationDevicesRequest { + r.facility = &facility + return r +} + +// Filter by partial hostname +func (r ApiFindOrganizationDevicesRequest) Hostname(hostname string) ApiFindOrganizationDevicesRequest { + r.hostname = &hostname + return r +} + +// Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances. +func (r ApiFindOrganizationDevicesRequest) Reserved(reserved bool) ApiFindOrganizationDevicesRequest { + r.reserved = &reserved + return r +} + +// Filter by device tag +func (r ApiFindOrganizationDevicesRequest) Tag(tag string) ApiFindOrganizationDevicesRequest { + r.tag = &tag + return r +} + +// Filter by instance type (ondemand,spot,reserved) +func (r ApiFindOrganizationDevicesRequest) Type_(type_ string) ApiFindOrganizationDevicesRequest { + r.type_ = &type_ + return r +} + +// Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time. +func (r ApiFindOrganizationDevicesRequest) HasTerminationTime(hasTerminationTime bool) ApiFindOrganizationDevicesRequest { + r.hasTerminationTime = &hasTerminationTime + return r +} + +// Filter by MAC address +func (r ApiFindOrganizationDevicesRequest) MacAddress(macAddress string) ApiFindOrganizationDevicesRequest { + r.macAddress = &macAddress + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindOrganizationDevicesRequest) Include(include []string) ApiFindOrganizationDevicesRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindOrganizationDevicesRequest) Exclude(exclude []string) ApiFindOrganizationDevicesRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindOrganizationDevicesRequest) Page(page int32) ApiFindOrganizationDevicesRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindOrganizationDevicesRequest) PerPage(perPage int32) ApiFindOrganizationDevicesRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindOrganizationDevicesRequest) Execute() (*DeviceList, *http.Response, error) { + return r.ApiService.FindOrganizationDevicesExecute(r) +} + +/* +FindOrganizationDevices Retrieve all devices of an organization + +Provides a collection of devices for a given organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOrganizationDevicesRequest +*/ +func (a *DevicesApiService) FindOrganizationDevices(ctx context.Context, id string) ApiFindOrganizationDevicesRequest { + return ApiFindOrganizationDevicesRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return DeviceList +func (a *DevicesApiService) FindOrganizationDevicesExecute(r ApiFindOrganizationDevicesRequest) (*DeviceList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeviceList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.FindOrganizationDevices") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/devices" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.search != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "") + } + if r.categories != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "categories", r.categories, "csv") + } + if r.facility != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "facility", r.facility, "") + } + if r.hostname != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "hostname", r.hostname, "") + } + if r.reserved != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "reserved", r.reserved, "") + } + if r.tag != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "tag", r.tag, "") + } + if r.type_ != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "type", r.type_, "") + } + if r.hasTerminationTime != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "has_termination_time", r.hasTerminationTime, "") + } + if r.macAddress != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "mac_address", r.macAddress, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return DeviceList +func (r ApiFindOrganizationDevicesRequest) ExecuteWithPagination() (*DeviceList, error) { + + var items DeviceList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Devices = append(items.Devices, page.Devices...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiFindProjectDevicesRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + search *string + categories *[]FindOrganizationDevicesCategoriesParameterInner + facility *string + metro *string + hostname *string + reserved *bool + tag *string + type_ *string + hasTerminationTime *bool + macAddress *string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Search by hostname, description, short_id, reservation short_id, tags, plan name, plan slug, facility code, facility name, operating system name, operating system slug, IP addresses. +func (r ApiFindProjectDevicesRequest) Search(search string) ApiFindProjectDevicesRequest { + r.search = &search + return r +} + +// Filter by plan category +func (r ApiFindProjectDevicesRequest) Categories(categories []FindOrganizationDevicesCategoriesParameterInner) ApiFindProjectDevicesRequest { + r.categories = &categories + return r +} + +// Filter by device facility +func (r ApiFindProjectDevicesRequest) Facility(facility string) ApiFindProjectDevicesRequest { + r.facility = &facility + return r +} + +// Filter by device metro +func (r ApiFindProjectDevicesRequest) Metro(metro string) ApiFindProjectDevicesRequest { + r.metro = &metro + return r +} + +// Filter by partial hostname +func (r ApiFindProjectDevicesRequest) Hostname(hostname string) ApiFindProjectDevicesRequest { + r.hostname = &hostname + return r +} + +// Filter only reserved instances. When set to true, only include reserved instances. When set to false, only include on-demand instances. +func (r ApiFindProjectDevicesRequest) Reserved(reserved bool) ApiFindProjectDevicesRequest { + r.reserved = &reserved + return r +} + +// Filter by device tag +func (r ApiFindProjectDevicesRequest) Tag(tag string) ApiFindProjectDevicesRequest { + r.tag = &tag + return r +} + +// Filter by instance type (ondemand,spot,reserved) +func (r ApiFindProjectDevicesRequest) Type_(type_ string) ApiFindProjectDevicesRequest { + r.type_ = &type_ + return r +} + +// Filter only instances marked for termination. When set to true, only include instances that have a termination time. When set to false, only include instances that do not have a termination time. +func (r ApiFindProjectDevicesRequest) HasTerminationTime(hasTerminationTime bool) ApiFindProjectDevicesRequest { + r.hasTerminationTime = &hasTerminationTime + return r +} + +// Filter by MAC address +func (r ApiFindProjectDevicesRequest) MacAddress(macAddress string) ApiFindProjectDevicesRequest { + r.macAddress = &macAddress + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindProjectDevicesRequest) Include(include []string) ApiFindProjectDevicesRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindProjectDevicesRequest) Exclude(exclude []string) ApiFindProjectDevicesRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindProjectDevicesRequest) Page(page int32) ApiFindProjectDevicesRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindProjectDevicesRequest) PerPage(perPage int32) ApiFindProjectDevicesRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindProjectDevicesRequest) Execute() (*DeviceList, *http.Response, error) { + return r.ApiService.FindProjectDevicesExecute(r) +} + +/* +FindProjectDevices Retrieve all devices of a project + +Provides a collection of devices for a given project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindProjectDevicesRequest +*/ +func (a *DevicesApiService) FindProjectDevices(ctx context.Context, id string) ApiFindProjectDevicesRequest { + return ApiFindProjectDevicesRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return DeviceList +func (a *DevicesApiService) FindProjectDevicesExecute(r ApiFindProjectDevicesRequest) (*DeviceList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeviceList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.FindProjectDevices") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/devices" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.search != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "") + } + if r.categories != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "categories", r.categories, "csv") + } + if r.facility != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "facility", r.facility, "") + } + if r.metro != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "metro", r.metro, "") + } + if r.hostname != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "hostname", r.hostname, "") + } + if r.reserved != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "reserved", r.reserved, "") + } + if r.tag != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "tag", r.tag, "") + } + if r.type_ != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "type", r.type_, "") + } + if r.hasTerminationTime != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "has_termination_time", r.hasTerminationTime, "") + } + if r.macAddress != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "mac_address", r.macAddress, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return DeviceList +func (r ApiFindProjectDevicesRequest) ExecuteWithPagination() (*DeviceList, error) { + + var items DeviceList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Devices = append(items.Devices, page.Devices...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiFindTrafficRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + direction *FindTrafficDirectionParameter + interval *FindTrafficIntervalParameter + bucket *FindTrafficBucketParameter + timeframe *FindTrafficTimeframeParameter +} + +// Traffic direction +func (r ApiFindTrafficRequest) Direction(direction FindTrafficDirectionParameter) ApiFindTrafficRequest { + r.direction = &direction + return r +} + +// Traffic interval +func (r ApiFindTrafficRequest) Interval(interval FindTrafficIntervalParameter) ApiFindTrafficRequest { + r.interval = &interval + return r +} + +// Traffic bucket +func (r ApiFindTrafficRequest) Bucket(bucket FindTrafficBucketParameter) ApiFindTrafficRequest { + r.bucket = &bucket + return r +} + +func (r ApiFindTrafficRequest) Timeframe(timeframe FindTrafficTimeframeParameter) ApiFindTrafficRequest { + r.timeframe = &timeframe + return r +} + +func (r ApiFindTrafficRequest) Execute() (*http.Response, error) { + return r.ApiService.FindTrafficExecute(r) +} + +/* +FindTraffic Retrieve device traffic + +Returns traffic for a specific device. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiFindTrafficRequest +*/ +func (a *DevicesApiService) FindTraffic(ctx context.Context, id string) ApiFindTrafficRequest { + return ApiFindTrafficRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DevicesApiService) FindTrafficExecute(r ApiFindTrafficRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.FindTraffic") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/traffic" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.direction == nil { + return nil, reportError("direction is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "direction", r.direction, "") + if r.interval != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "interval", r.interval, "") + } + if r.bucket != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "bucket", r.bucket, "") + } + if r.timeframe != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "timeframe", r.timeframe, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetBgpNeighborDataRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiGetBgpNeighborDataRequest) Include(include []string) ApiGetBgpNeighborDataRequest { + r.include = &include + return r +} + +func (r ApiGetBgpNeighborDataRequest) Execute() (*BgpSessionNeighbors, *http.Response, error) { + return r.ApiService.GetBgpNeighborDataExecute(r) +} + +/* +GetBgpNeighborData Retrieve BGP neighbor data for this device + +Provides a summary of the BGP neighbor data associated to the BGP sessions for this device. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiGetBgpNeighborDataRequest +*/ +func (a *DevicesApiService) GetBgpNeighborData(ctx context.Context, id string) ApiGetBgpNeighborDataRequest { + return ApiGetBgpNeighborDataRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BgpSessionNeighbors +func (a *DevicesApiService) GetBgpNeighborDataExecute(r ApiGetBgpNeighborDataRequest) (*BgpSessionNeighbors, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BgpSessionNeighbors + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.GetBgpNeighborData") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/bgp/neighbors" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetDeviceFirmwareSetsRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string +} + +func (r ApiGetDeviceFirmwareSetsRequest) Execute() (*FirmwareSetResponse, *http.Response, error) { + return r.ApiService.GetDeviceFirmwareSetsExecute(r) +} + +/* +GetDeviceFirmwareSets Get Device's associated Firmware Set + +Returns the firmware set associated with the device. If a custom firmware set is associated with the device, then it is returned. Otherwise, if a default firmware set is available it is returned. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiGetDeviceFirmwareSetsRequest +*/ +func (a *DevicesApiService) GetDeviceFirmwareSets(ctx context.Context, id string) ApiGetDeviceFirmwareSetsRequest { + return ApiGetDeviceFirmwareSetsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return FirmwareSetResponse +func (a *DevicesApiService) GetDeviceFirmwareSetsExecute(r ApiGetDeviceFirmwareSetsRequest) (*FirmwareSetResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FirmwareSetResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.GetDeviceFirmwareSets") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/firmware-sets" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetDeviceHealthRollupRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string +} + +func (r ApiGetDeviceHealthRollupRequest) Execute() (*DeviceHealthRollup, *http.Response, error) { + return r.ApiService.GetDeviceHealthRollupExecute(r) +} + +/* +GetDeviceHealthRollup Get Device's Health Status + +Returns the health rollup status of the device. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiGetDeviceHealthRollupRequest +*/ +func (a *DevicesApiService) GetDeviceHealthRollup(ctx context.Context, id string) ApiGetDeviceHealthRollupRequest { + return ApiGetDeviceHealthRollupRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return DeviceHealthRollup +func (a *DevicesApiService) GetDeviceHealthRollupExecute(r ApiGetDeviceHealthRollupRequest) (*DeviceHealthRollup, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeviceHealthRollup + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.GetDeviceHealthRollup") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/diagnostics/health/rollup" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiPerformActionRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + deviceActionInput *DeviceActionInput +} + +// Action to perform +func (r ApiPerformActionRequest) DeviceActionInput(deviceActionInput DeviceActionInput) ApiPerformActionRequest { + r.deviceActionInput = &deviceActionInput + return r +} + +func (r ApiPerformActionRequest) Execute() (*http.Response, error) { + return r.ApiService.PerformActionExecute(r) +} + +/* +PerformAction Perform an action + +Performs an action for the given device. Possible actions include: power_on, power_off, reboot, reinstall, and rescue (reboot the device into rescue OS.) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiPerformActionRequest +*/ +func (a *DevicesApiService) PerformAction(ctx context.Context, id string) ApiPerformActionRequest { + return ApiPerformActionRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *DevicesApiService) PerformActionExecute(r ApiPerformActionRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.PerformAction") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/actions" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.deviceActionInput == nil { + return nil, reportError("deviceActionInput is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.deviceActionInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiUpdateDeviceRequest struct { + ctx context.Context + ApiService *DevicesApiService + id string + deviceUpdateInput *DeviceUpdateInput + include *[]string + exclude *[]string +} + +// Device to update +func (r ApiUpdateDeviceRequest) DeviceUpdateInput(deviceUpdateInput DeviceUpdateInput) ApiUpdateDeviceRequest { + r.deviceUpdateInput = &deviceUpdateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateDeviceRequest) Include(include []string) ApiUpdateDeviceRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiUpdateDeviceRequest) Exclude(exclude []string) ApiUpdateDeviceRequest { + r.exclude = &exclude + return r +} + +func (r ApiUpdateDeviceRequest) Execute() (*Device, *http.Response, error) { + return r.ApiService.UpdateDeviceExecute(r) +} + +/* +UpdateDevice Update the device + +Updates the device. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiUpdateDeviceRequest +*/ +func (a *DevicesApiService) UpdateDevice(ctx context.Context, id string) ApiUpdateDeviceRequest { + return ApiUpdateDeviceRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Device +func (a *DevicesApiService) UpdateDeviceExecute(r ApiUpdateDeviceRequest) (*Device, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Device + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DevicesApiService.UpdateDevice") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.deviceUpdateInput == nil { + return localVarReturnValue, nil, reportError("deviceUpdateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.deviceUpdateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_emails.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_emails.go new file mode 100644 index 00000000..77bd0b1d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_emails.go @@ -0,0 +1,632 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// EmailsApiService EmailsApi service +type EmailsApiService service + +type ApiCreateEmailRequest struct { + ctx context.Context + ApiService *EmailsApiService + createEmailInput *CreateEmailInput +} + +// Email to create +func (r ApiCreateEmailRequest) CreateEmailInput(createEmailInput CreateEmailInput) ApiCreateEmailRequest { + r.createEmailInput = &createEmailInput + return r +} + +func (r ApiCreateEmailRequest) Execute() (*Email, *http.Response, error) { + return r.ApiService.CreateEmailExecute(r) +} + +/* +CreateEmail Create an email + +Add a new email address to the current user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateEmailRequest +*/ +func (a *EmailsApiService) CreateEmail(ctx context.Context) ApiCreateEmailRequest { + return ApiCreateEmailRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return Email +func (a *EmailsApiService) CreateEmailExecute(r ApiCreateEmailRequest) (*Email, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Email + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EmailsApiService.CreateEmail") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/emails" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createEmailInput == nil { + return localVarReturnValue, nil, reportError("createEmailInput is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createEmailInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteEmailRequest struct { + ctx context.Context + ApiService *EmailsApiService + id string +} + +func (r ApiDeleteEmailRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteEmailExecute(r) +} + +/* +DeleteEmail Delete the email + +Deletes the email. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Email UUID + @return ApiDeleteEmailRequest +*/ +func (a *EmailsApiService) DeleteEmail(ctx context.Context, id string) ApiDeleteEmailRequest { + return ApiDeleteEmailRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *EmailsApiService) DeleteEmailExecute(r ApiDeleteEmailRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EmailsApiService.DeleteEmail") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/emails/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindEmailByIdRequest struct { + ctx context.Context + ApiService *EmailsApiService + id string +} + +func (r ApiFindEmailByIdRequest) Execute() (*Email, *http.Response, error) { + return r.ApiService.FindEmailByIdExecute(r) +} + +/* +FindEmailById Retrieve an email + +Provides one of the user’s emails. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Email UUID + @return ApiFindEmailByIdRequest +*/ +func (a *EmailsApiService) FindEmailById(ctx context.Context, id string) ApiFindEmailByIdRequest { + return ApiFindEmailByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Email +func (a *EmailsApiService) FindEmailByIdExecute(r ApiFindEmailByIdRequest) (*Email, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Email + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EmailsApiService.FindEmailById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/emails/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateEmailRequest struct { + ctx context.Context + ApiService *EmailsApiService + id string + updateEmailInput *UpdateEmailInput +} + +// email to update +func (r ApiUpdateEmailRequest) UpdateEmailInput(updateEmailInput UpdateEmailInput) ApiUpdateEmailRequest { + r.updateEmailInput = &updateEmailInput + return r +} + +func (r ApiUpdateEmailRequest) Execute() (*Email, *http.Response, error) { + return r.ApiService.UpdateEmailExecute(r) +} + +/* +UpdateEmail Update the email + +Updates the email. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Email UUID + @return ApiUpdateEmailRequest +*/ +func (a *EmailsApiService) UpdateEmail(ctx context.Context, id string) ApiUpdateEmailRequest { + return ApiUpdateEmailRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Email +func (a *EmailsApiService) UpdateEmailExecute(r ApiUpdateEmailRequest) (*Email, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Email + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EmailsApiService.UpdateEmail") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/emails/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateEmailInput == nil { + return localVarReturnValue, nil, reportError("updateEmailInput is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateEmailInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_events.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_events.go new file mode 100644 index 00000000..94f303ae --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_events.go @@ -0,0 +1,1817 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// EventsApiService EventsApi service +type EventsApiService service + +type ApiFindDeviceEventsRequest struct { + ctx context.Context + ApiService *EventsApiService + id string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindDeviceEventsRequest) Include(include []string) ApiFindDeviceEventsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindDeviceEventsRequest) Exclude(exclude []string) ApiFindDeviceEventsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindDeviceEventsRequest) Page(page int32) ApiFindDeviceEventsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindDeviceEventsRequest) PerPage(perPage int32) ApiFindDeviceEventsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindDeviceEventsRequest) Execute() (*EventList, *http.Response, error) { + return r.ApiService.FindDeviceEventsExecute(r) +} + +/* +FindDeviceEvents Retrieve device's events + +Returns a list of events pertaining to a specific device + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiFindDeviceEventsRequest +*/ +func (a *EventsApiService) FindDeviceEvents(ctx context.Context, id string) ApiFindDeviceEventsRequest { + return ApiFindDeviceEventsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return EventList +func (a *EventsApiService) FindDeviceEventsExecute(r ApiFindDeviceEventsRequest) (*EventList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EventList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EventsApiService.FindDeviceEvents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/events" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return EventList +func (r ApiFindDeviceEventsRequest) ExecuteWithPagination() (*EventList, error) { + + var items EventList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Events = append(items.Events, page.Events...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiFindEventByIdRequest struct { + ctx context.Context + ApiService *EventsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindEventByIdRequest) Include(include []string) ApiFindEventByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindEventByIdRequest) Exclude(exclude []string) ApiFindEventByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindEventByIdRequest) Execute() (*Event, *http.Response, error) { + return r.ApiService.FindEventByIdExecute(r) +} + +/* +FindEventById Retrieve an event + +Returns a single event if the user has access + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Event UUID + @return ApiFindEventByIdRequest +*/ +func (a *EventsApiService) FindEventById(ctx context.Context, id string) ApiFindEventByIdRequest { + return ApiFindEventByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Event +func (a *EventsApiService) FindEventByIdExecute(r ApiFindEventByIdRequest) (*Event, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Event + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EventsApiService.FindEventById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/events/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindEventsRequest struct { + ctx context.Context + ApiService *EventsApiService + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindEventsRequest) Include(include []string) ApiFindEventsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindEventsRequest) Exclude(exclude []string) ApiFindEventsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindEventsRequest) Page(page int32) ApiFindEventsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindEventsRequest) PerPage(perPage int32) ApiFindEventsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindEventsRequest) Execute() (*EventList, *http.Response, error) { + return r.ApiService.FindEventsExecute(r) +} + +/* +FindEvents Retrieve current user's events + +Returns a list of the current user’s events + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindEventsRequest +*/ +func (a *EventsApiService) FindEvents(ctx context.Context) ApiFindEventsRequest { + return ApiFindEventsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return EventList +func (a *EventsApiService) FindEventsExecute(r ApiFindEventsRequest) (*EventList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EventList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EventsApiService.FindEvents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/events" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return EventList +func (r ApiFindEventsRequest) ExecuteWithPagination() (*EventList, error) { + + var items EventList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Events = append(items.Events, page.Events...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiFindInterconnectionEventsRequest struct { + ctx context.Context + ApiService *EventsApiService + connectionId string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindInterconnectionEventsRequest) Include(include []string) ApiFindInterconnectionEventsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindInterconnectionEventsRequest) Exclude(exclude []string) ApiFindInterconnectionEventsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindInterconnectionEventsRequest) Page(page int32) ApiFindInterconnectionEventsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindInterconnectionEventsRequest) PerPage(perPage int32) ApiFindInterconnectionEventsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindInterconnectionEventsRequest) Execute() (*EventList, *http.Response, error) { + return r.ApiService.FindInterconnectionEventsExecute(r) +} + +/* +FindInterconnectionEvents Retrieve interconnection events + +Returns a list of the interconnection events + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connectionId Interconnection UUID + @return ApiFindInterconnectionEventsRequest +*/ +func (a *EventsApiService) FindInterconnectionEvents(ctx context.Context, connectionId string) ApiFindInterconnectionEventsRequest { + return ApiFindInterconnectionEventsRequest{ + ApiService: a, + ctx: ctx, + connectionId: connectionId, + } +} + +// Execute executes the request +// +// @return EventList +func (a *EventsApiService) FindInterconnectionEventsExecute(r ApiFindInterconnectionEventsRequest) (*EventList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EventList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EventsApiService.FindInterconnectionEvents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections/{connection_id}/events" + localVarPath = strings.Replace(localVarPath, "{"+"connection_id"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return EventList +func (r ApiFindInterconnectionEventsRequest) ExecuteWithPagination() (*EventList, error) { + + var items EventList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Events = append(items.Events, page.Events...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiFindInterconnectionPortEventsRequest struct { + ctx context.Context + ApiService *EventsApiService + connectionId string + id string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindInterconnectionPortEventsRequest) Include(include []string) ApiFindInterconnectionPortEventsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindInterconnectionPortEventsRequest) Exclude(exclude []string) ApiFindInterconnectionPortEventsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindInterconnectionPortEventsRequest) Page(page int32) ApiFindInterconnectionPortEventsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindInterconnectionPortEventsRequest) PerPage(perPage int32) ApiFindInterconnectionPortEventsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindInterconnectionPortEventsRequest) Execute() (*Event, *http.Response, error) { + return r.ApiService.FindInterconnectionPortEventsExecute(r) +} + +/* +FindInterconnectionPortEvents Retrieve interconnection port events + +Returns a list of the interconnection port events + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connectionId Interconnection UUID + @param id Interconnection Port UUID + @return ApiFindInterconnectionPortEventsRequest +*/ +func (a *EventsApiService) FindInterconnectionPortEvents(ctx context.Context, connectionId string, id string) ApiFindInterconnectionPortEventsRequest { + return ApiFindInterconnectionPortEventsRequest{ + ApiService: a, + ctx: ctx, + connectionId: connectionId, + id: id, + } +} + +// Execute executes the request +// +// @return Event +func (a *EventsApiService) FindInterconnectionPortEventsExecute(r ApiFindInterconnectionPortEventsRequest) (*Event, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Event + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EventsApiService.FindInterconnectionPortEvents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections/{connection_id}/ports/{id}/events" + localVarPath = strings.Replace(localVarPath, "{"+"connection_id"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindOrganizationEventsRequest struct { + ctx context.Context + ApiService *EventsApiService + id string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindOrganizationEventsRequest) Include(include []string) ApiFindOrganizationEventsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindOrganizationEventsRequest) Exclude(exclude []string) ApiFindOrganizationEventsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindOrganizationEventsRequest) Page(page int32) ApiFindOrganizationEventsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindOrganizationEventsRequest) PerPage(perPage int32) ApiFindOrganizationEventsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindOrganizationEventsRequest) Execute() (*EventList, *http.Response, error) { + return r.ApiService.FindOrganizationEventsExecute(r) +} + +/* +FindOrganizationEvents Retrieve organization's events + +Returns a list of events for a single organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOrganizationEventsRequest +*/ +func (a *EventsApiService) FindOrganizationEvents(ctx context.Context, id string) ApiFindOrganizationEventsRequest { + return ApiFindOrganizationEventsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return EventList +func (a *EventsApiService) FindOrganizationEventsExecute(r ApiFindOrganizationEventsRequest) (*EventList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EventList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EventsApiService.FindOrganizationEvents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/events" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return EventList +func (r ApiFindOrganizationEventsRequest) ExecuteWithPagination() (*EventList, error) { + + var items EventList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Events = append(items.Events, page.Events...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiFindProjectEventsRequest struct { + ctx context.Context + ApiService *EventsApiService + id string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindProjectEventsRequest) Include(include []string) ApiFindProjectEventsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindProjectEventsRequest) Exclude(exclude []string) ApiFindProjectEventsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindProjectEventsRequest) Page(page int32) ApiFindProjectEventsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindProjectEventsRequest) PerPage(perPage int32) ApiFindProjectEventsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindProjectEventsRequest) Execute() (*EventList, *http.Response, error) { + return r.ApiService.FindProjectEventsExecute(r) +} + +/* +FindProjectEvents Retrieve project's events + +Returns a list of events for a single project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindProjectEventsRequest +*/ +func (a *EventsApiService) FindProjectEvents(ctx context.Context, id string) ApiFindProjectEventsRequest { + return ApiFindProjectEventsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return EventList +func (a *EventsApiService) FindProjectEventsExecute(r ApiFindProjectEventsRequest) (*EventList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EventList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EventsApiService.FindProjectEvents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/events" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return EventList +func (r ApiFindProjectEventsRequest) ExecuteWithPagination() (*EventList, error) { + + var items EventList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Events = append(items.Events, page.Events...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiFindVirtualCircuitEventsRequest struct { + ctx context.Context + ApiService *EventsApiService + id string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindVirtualCircuitEventsRequest) Include(include []string) ApiFindVirtualCircuitEventsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindVirtualCircuitEventsRequest) Exclude(exclude []string) ApiFindVirtualCircuitEventsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindVirtualCircuitEventsRequest) Page(page int32) ApiFindVirtualCircuitEventsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindVirtualCircuitEventsRequest) PerPage(perPage int32) ApiFindVirtualCircuitEventsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindVirtualCircuitEventsRequest) Execute() (*Event, *http.Response, error) { + return r.ApiService.FindVirtualCircuitEventsExecute(r) +} + +/* +FindVirtualCircuitEvents Retrieve virtual circuit events + +Returns a list of the virtual circuit events + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Virtual Circuit UUID + @return ApiFindVirtualCircuitEventsRequest +*/ +func (a *EventsApiService) FindVirtualCircuitEvents(ctx context.Context, id string) ApiFindVirtualCircuitEventsRequest { + return ApiFindVirtualCircuitEventsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Event +func (a *EventsApiService) FindVirtualCircuitEventsExecute(r ApiFindVirtualCircuitEventsRequest) (*Event, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Event + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EventsApiService.FindVirtualCircuitEvents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/virtual-circuits/{id}/events" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindVrfRouteEventsRequest struct { + ctx context.Context + ApiService *EventsApiService + id string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindVrfRouteEventsRequest) Include(include []string) ApiFindVrfRouteEventsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindVrfRouteEventsRequest) Exclude(exclude []string) ApiFindVrfRouteEventsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindVrfRouteEventsRequest) Page(page int32) ApiFindVrfRouteEventsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindVrfRouteEventsRequest) PerPage(perPage int32) ApiFindVrfRouteEventsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindVrfRouteEventsRequest) Execute() (*Event, *http.Response, error) { + return r.ApiService.FindVrfRouteEventsExecute(r) +} + +/* +FindVrfRouteEvents Retrieve VRF route events + +Returns a list of the VRF route events + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id VRF Route UUID + @return ApiFindVrfRouteEventsRequest +*/ +func (a *EventsApiService) FindVrfRouteEvents(ctx context.Context, id string) ApiFindVrfRouteEventsRequest { + return ApiFindVrfRouteEventsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Event +func (a *EventsApiService) FindVrfRouteEventsExecute(r ApiFindVrfRouteEventsRequest) (*Event, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Event + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EventsApiService.FindVrfRouteEvents") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/routes/{id}/events" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_facilities.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_facilities.go new file mode 100644 index 00000000..96fc1d17 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_facilities.go @@ -0,0 +1,520 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// FacilitiesApiService FacilitiesApi service +type FacilitiesApiService service + +type ApiFindFacilitiesRequest struct { + ctx context.Context + ApiService *FacilitiesApiService + include *[]FindFacilitiesIncludeParameterInner + exclude *[]FindFacilitiesIncludeParameterInner +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindFacilitiesRequest) Include(include []FindFacilitiesIncludeParameterInner) ApiFindFacilitiesRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindFacilitiesRequest) Exclude(exclude []FindFacilitiesIncludeParameterInner) ApiFindFacilitiesRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindFacilitiesRequest) Execute() (*FacilityList, *http.Response, error) { + return r.ApiService.FindFacilitiesExecute(r) +} + +/* +FindFacilities Retrieve all facilities + +Provides a listing of available datacenters where you can provision Packet devices. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindFacilitiesRequest + +Deprecated +*/ +func (a *FacilitiesApiService) FindFacilities(ctx context.Context) ApiFindFacilitiesRequest { + return ApiFindFacilitiesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return FacilityList +// +// Deprecated +func (a *FacilitiesApiService) FindFacilitiesExecute(r ApiFindFacilitiesRequest) (*FacilityList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FacilityList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FacilitiesApiService.FindFacilities") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/facilities" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindFacilitiesByOrganizationRequest struct { + ctx context.Context + ApiService *FacilitiesApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindFacilitiesByOrganizationRequest) Include(include []string) ApiFindFacilitiesByOrganizationRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindFacilitiesByOrganizationRequest) Exclude(exclude []string) ApiFindFacilitiesByOrganizationRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindFacilitiesByOrganizationRequest) Execute() (*FacilityList, *http.Response, error) { + return r.ApiService.FindFacilitiesByOrganizationExecute(r) +} + +/* +FindFacilitiesByOrganization Retrieve all facilities visible by the organization + +Returns a listing of available datacenters for the given organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindFacilitiesByOrganizationRequest + +Deprecated +*/ +func (a *FacilitiesApiService) FindFacilitiesByOrganization(ctx context.Context, id string) ApiFindFacilitiesByOrganizationRequest { + return ApiFindFacilitiesByOrganizationRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return FacilityList +// +// Deprecated +func (a *FacilitiesApiService) FindFacilitiesByOrganizationExecute(r ApiFindFacilitiesByOrganizationRequest) (*FacilityList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FacilityList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FacilitiesApiService.FindFacilitiesByOrganization") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/facilities" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindFacilitiesByProjectRequest struct { + ctx context.Context + ApiService *FacilitiesApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindFacilitiesByProjectRequest) Include(include []string) ApiFindFacilitiesByProjectRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindFacilitiesByProjectRequest) Exclude(exclude []string) ApiFindFacilitiesByProjectRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindFacilitiesByProjectRequest) Execute() (*FacilityList, *http.Response, error) { + return r.ApiService.FindFacilitiesByProjectExecute(r) +} + +/* +FindFacilitiesByProject Retrieve all facilities visible by the project + +Returns a listing of available datacenters for the given project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindFacilitiesByProjectRequest + +Deprecated +*/ +func (a *FacilitiesApiService) FindFacilitiesByProject(ctx context.Context, id string) ApiFindFacilitiesByProjectRequest { + return ApiFindFacilitiesByProjectRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return FacilityList +// +// Deprecated +func (a *FacilitiesApiService) FindFacilitiesByProjectExecute(r ApiFindFacilitiesByProjectRequest) (*FacilityList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FacilityList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FacilitiesApiService.FindFacilitiesByProject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/facilities" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_firmware_sets.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_firmware_sets.go new file mode 100644 index 00000000..f2a0cb26 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_firmware_sets.go @@ -0,0 +1,320 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// FirmwareSetsApiService FirmwareSetsApi service +type FirmwareSetsApiService service + +type ApiGetOrganizationFirmwareSetsRequest struct { + ctx context.Context + ApiService *FirmwareSetsApiService + id string + page *int32 + perPage *int32 +} + +// page number to return +func (r ApiGetOrganizationFirmwareSetsRequest) Page(page int32) ApiGetOrganizationFirmwareSetsRequest { + r.page = &page + return r +} + +// items returned per page. +func (r ApiGetOrganizationFirmwareSetsRequest) PerPage(perPage int32) ApiGetOrganizationFirmwareSetsRequest { + r.perPage = &perPage + return r +} + +func (r ApiGetOrganizationFirmwareSetsRequest) Execute() (*FirmwareSetListResponse, *http.Response, error) { + return r.ApiService.GetOrganizationFirmwareSetsExecute(r) +} + +/* +GetOrganizationFirmwareSets Get Organization's Firmware Sets + +Returns all firmware sets associated with the organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiGetOrganizationFirmwareSetsRequest +*/ +func (a *FirmwareSetsApiService) GetOrganizationFirmwareSets(ctx context.Context, id string) ApiGetOrganizationFirmwareSetsRequest { + return ApiGetOrganizationFirmwareSetsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return FirmwareSetListResponse +func (a *FirmwareSetsApiService) GetOrganizationFirmwareSetsExecute(r ApiGetOrganizationFirmwareSetsRequest) (*FirmwareSetListResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FirmwareSetListResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FirmwareSetsApiService.GetOrganizationFirmwareSets") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/firmware-sets" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetProjectFirmwareSetsRequest struct { + ctx context.Context + ApiService *FirmwareSetsApiService + id string + page *int32 + perPage *int32 +} + +// page number to return +func (r ApiGetProjectFirmwareSetsRequest) Page(page int32) ApiGetProjectFirmwareSetsRequest { + r.page = &page + return r +} + +// items returned per page. +func (r ApiGetProjectFirmwareSetsRequest) PerPage(perPage int32) ApiGetProjectFirmwareSetsRequest { + r.perPage = &perPage + return r +} + +func (r ApiGetProjectFirmwareSetsRequest) Execute() (*FirmwareSetListResponse, *http.Response, error) { + return r.ApiService.GetProjectFirmwareSetsExecute(r) +} + +/* +GetProjectFirmwareSets Get Project's Firmware Sets + +Returns all firmware sets associated with the project or organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiGetProjectFirmwareSetsRequest +*/ +func (a *FirmwareSetsApiService) GetProjectFirmwareSets(ctx context.Context, id string) ApiGetProjectFirmwareSetsRequest { + return ApiGetProjectFirmwareSetsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return FirmwareSetListResponse +func (a *FirmwareSetsApiService) GetProjectFirmwareSetsExecute(r ApiGetProjectFirmwareSetsRequest) (*FirmwareSetListResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FirmwareSetListResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FirmwareSetsApiService.GetProjectFirmwareSets") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/firmware-sets" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_hardware_reservations.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_hardware_reservations.go new file mode 100644 index 00000000..0315dd36 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_hardware_reservations.go @@ -0,0 +1,800 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// HardwareReservationsApiService HardwareReservationsApi service +type HardwareReservationsApiService service + +type ApiActivateHardwareReservationRequest struct { + ctx context.Context + ApiService *HardwareReservationsApiService + id string + include *[]string + exclude *[]string + activateHardwareReservationRequest *ActivateHardwareReservationRequest +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiActivateHardwareReservationRequest) Include(include []string) ApiActivateHardwareReservationRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiActivateHardwareReservationRequest) Exclude(exclude []string) ApiActivateHardwareReservationRequest { + r.exclude = &exclude + return r +} + +// Note to attach to the reservation +func (r ApiActivateHardwareReservationRequest) ActivateHardwareReservationRequest(activateHardwareReservationRequest ActivateHardwareReservationRequest) ApiActivateHardwareReservationRequest { + r.activateHardwareReservationRequest = &activateHardwareReservationRequest + return r +} + +func (r ApiActivateHardwareReservationRequest) Execute() (*HardwareReservation, *http.Response, error) { + return r.ApiService.ActivateHardwareReservationExecute(r) +} + +/* +ActivateHardwareReservation Activate a spare hardware reservation + +Activate a spare hardware reservation + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Hardware Reservation UUID + @return ApiActivateHardwareReservationRequest +*/ +func (a *HardwareReservationsApiService) ActivateHardwareReservation(ctx context.Context, id string) ApiActivateHardwareReservationRequest { + return ApiActivateHardwareReservationRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return HardwareReservation +func (a *HardwareReservationsApiService) ActivateHardwareReservationExecute(r ApiActivateHardwareReservationRequest) (*HardwareReservation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *HardwareReservation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HardwareReservationsApiService.ActivateHardwareReservation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/hardware-reservations/{id}/activate" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.activateHardwareReservationRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindHardwareReservationByIdRequest struct { + ctx context.Context + ApiService *HardwareReservationsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindHardwareReservationByIdRequest) Include(include []string) ApiFindHardwareReservationByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindHardwareReservationByIdRequest) Exclude(exclude []string) ApiFindHardwareReservationByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindHardwareReservationByIdRequest) Execute() (*HardwareReservation, *http.Response, error) { + return r.ApiService.FindHardwareReservationByIdExecute(r) +} + +/* +FindHardwareReservationById Retrieve a hardware reservation + +Returns a single hardware reservation + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id HardwareReservation UUID + @return ApiFindHardwareReservationByIdRequest +*/ +func (a *HardwareReservationsApiService) FindHardwareReservationById(ctx context.Context, id string) ApiFindHardwareReservationByIdRequest { + return ApiFindHardwareReservationByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return HardwareReservation +func (a *HardwareReservationsApiService) FindHardwareReservationByIdExecute(r ApiFindHardwareReservationByIdRequest) (*HardwareReservation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *HardwareReservation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HardwareReservationsApiService.FindHardwareReservationById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/hardware-reservations/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindProjectHardwareReservationsRequest struct { + ctx context.Context + ApiService *HardwareReservationsApiService + id string + query *string + state *FindProjectHardwareReservationsStateParameter + provisionable *FindProjectHardwareReservationsProvisionableParameter + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Search by facility code, plan name, project name, reservation short ID or device hostname +func (r ApiFindProjectHardwareReservationsRequest) Query(query string) ApiFindProjectHardwareReservationsRequest { + r.query = &query + return r +} + +// Filter by hardware reservation state +func (r ApiFindProjectHardwareReservationsRequest) State(state FindProjectHardwareReservationsStateParameter) ApiFindProjectHardwareReservationsRequest { + r.state = &state + return r +} + +// Filter hardware reservation that is provisionable +func (r ApiFindProjectHardwareReservationsRequest) Provisionable(provisionable FindProjectHardwareReservationsProvisionableParameter) ApiFindProjectHardwareReservationsRequest { + r.provisionable = &provisionable + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindProjectHardwareReservationsRequest) Include(include []string) ApiFindProjectHardwareReservationsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindProjectHardwareReservationsRequest) Exclude(exclude []string) ApiFindProjectHardwareReservationsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindProjectHardwareReservationsRequest) Page(page int32) ApiFindProjectHardwareReservationsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindProjectHardwareReservationsRequest) PerPage(perPage int32) ApiFindProjectHardwareReservationsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindProjectHardwareReservationsRequest) Execute() (*HardwareReservationList, *http.Response, error) { + return r.ApiService.FindProjectHardwareReservationsExecute(r) +} + +/* +FindProjectHardwareReservations Retrieve all hardware reservations for a given project + +Provides a collection of hardware reservations for a given project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindProjectHardwareReservationsRequest +*/ +func (a *HardwareReservationsApiService) FindProjectHardwareReservations(ctx context.Context, id string) ApiFindProjectHardwareReservationsRequest { + return ApiFindProjectHardwareReservationsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return HardwareReservationList +func (a *HardwareReservationsApiService) FindProjectHardwareReservationsExecute(r ApiFindProjectHardwareReservationsRequest) (*HardwareReservationList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *HardwareReservationList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HardwareReservationsApiService.FindProjectHardwareReservations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/hardware-reservations" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.query != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "query", r.query, "") + } + if r.state != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "state", r.state, "") + } + if r.provisionable != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "provisionable", r.provisionable, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return HardwareReservationList +func (r ApiFindProjectHardwareReservationsRequest) ExecuteWithPagination() (*HardwareReservationList, error) { + + var items HardwareReservationList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.HardwareReservations = append(items.HardwareReservations, page.HardwareReservations...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiMoveHardwareReservationRequest struct { + ctx context.Context + ApiService *HardwareReservationsApiService + id string + moveHardwareReservationRequest *MoveHardwareReservationRequest + include *[]string + exclude *[]string +} + +// Destination Project UUID +func (r ApiMoveHardwareReservationRequest) MoveHardwareReservationRequest(moveHardwareReservationRequest MoveHardwareReservationRequest) ApiMoveHardwareReservationRequest { + r.moveHardwareReservationRequest = &moveHardwareReservationRequest + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiMoveHardwareReservationRequest) Include(include []string) ApiMoveHardwareReservationRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiMoveHardwareReservationRequest) Exclude(exclude []string) ApiMoveHardwareReservationRequest { + r.exclude = &exclude + return r +} + +func (r ApiMoveHardwareReservationRequest) Execute() (*HardwareReservation, *http.Response, error) { + return r.ApiService.MoveHardwareReservationExecute(r) +} + +/* +MoveHardwareReservation Move a hardware reservation + +Move a hardware reservation to another project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Hardware Reservation UUID + @return ApiMoveHardwareReservationRequest +*/ +func (a *HardwareReservationsApiService) MoveHardwareReservation(ctx context.Context, id string) ApiMoveHardwareReservationRequest { + return ApiMoveHardwareReservationRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return HardwareReservation +func (a *HardwareReservationsApiService) MoveHardwareReservationExecute(r ApiMoveHardwareReservationRequest) (*HardwareReservation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *HardwareReservation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HardwareReservationsApiService.MoveHardwareReservation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/hardware-reservations/{id}/move" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.moveHardwareReservationRequest == nil { + return localVarReturnValue, nil, reportError("moveHardwareReservationRequest is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.moveHardwareReservationRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_incidents.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_incidents.go new file mode 100644 index 00000000..022f6be1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_incidents.go @@ -0,0 +1,155 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +// IncidentsApiService IncidentsApi service +type IncidentsApiService service + +type ApiFindIncidentsRequest struct { + ctx context.Context + ApiService *IncidentsApiService + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindIncidentsRequest) Include(include []string) ApiFindIncidentsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindIncidentsRequest) Exclude(exclude []string) ApiFindIncidentsRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindIncidentsRequest) Execute() (*http.Response, error) { + return r.ApiService.FindIncidentsExecute(r) +} + +/* +FindIncidents Retrieve the number of incidents + +Retrieve the number of incidents. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindIncidentsRequest +*/ +func (a *IncidentsApiService) FindIncidents(ctx context.Context) ApiFindIncidentsRequest { + return ApiFindIncidentsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *IncidentsApiService) FindIncidentsExecute(r ApiFindIncidentsRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IncidentsApiService.FindIncidents") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/incidents" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_interconnections.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_interconnections.go new file mode 100644 index 00000000..cb2d5fe4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_interconnections.go @@ -0,0 +1,2477 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// InterconnectionsApiService InterconnectionsApi service +type InterconnectionsApiService service + +type ApiCreateInterconnectionPortVirtualCircuitRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + connectionId string + portId string + virtualCircuitCreateInput *VirtualCircuitCreateInput +} + +// Virtual Circuit details +func (r ApiCreateInterconnectionPortVirtualCircuitRequest) VirtualCircuitCreateInput(virtualCircuitCreateInput VirtualCircuitCreateInput) ApiCreateInterconnectionPortVirtualCircuitRequest { + r.virtualCircuitCreateInput = &virtualCircuitCreateInput + return r +} + +func (r ApiCreateInterconnectionPortVirtualCircuitRequest) Execute() (*VirtualCircuit, *http.Response, error) { + return r.ApiService.CreateInterconnectionPortVirtualCircuitExecute(r) +} + +/* +CreateInterconnectionPortVirtualCircuit Create a new Virtual Circuit + +Create a new Virtual Circuit on a Dedicated Port. To create a regular Virtual Circuit, specify a Virtual Network record and an NNI VLAN value. To create a VRF-based Virtual Circuit, specify the VRF ID and subnet, along with the NNI VLAN value. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connectionId UUID of the interconnection + @param portId UUID of the interconnection port + @return ApiCreateInterconnectionPortVirtualCircuitRequest +*/ +func (a *InterconnectionsApiService) CreateInterconnectionPortVirtualCircuit(ctx context.Context, connectionId string, portId string) ApiCreateInterconnectionPortVirtualCircuitRequest { + return ApiCreateInterconnectionPortVirtualCircuitRequest{ + ApiService: a, + ctx: ctx, + connectionId: connectionId, + portId: portId, + } +} + +// Execute executes the request +// +// @return VirtualCircuit +func (a *InterconnectionsApiService) CreateInterconnectionPortVirtualCircuitExecute(r ApiCreateInterconnectionPortVirtualCircuitRequest) (*VirtualCircuit, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualCircuit + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.CreateInterconnectionPortVirtualCircuit") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections/{connection_id}/ports/{port_id}/virtual-circuits" + localVarPath = strings.Replace(localVarPath, "{"+"connection_id"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"port_id"+"}", url.PathEscape(parameterValueToString(r.portId, "portId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.virtualCircuitCreateInput == nil { + return localVarReturnValue, nil, reportError("virtualCircuitCreateInput is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.virtualCircuitCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateOrganizationInterconnectionRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + organizationId string + createOrganizationInterconnectionRequest *CreateOrganizationInterconnectionRequest + include *[]string + exclude *[]string +} + +// Dedicated port or shared interconnection (also known as Fabric VC) creation request +func (r ApiCreateOrganizationInterconnectionRequest) CreateOrganizationInterconnectionRequest(createOrganizationInterconnectionRequest CreateOrganizationInterconnectionRequest) ApiCreateOrganizationInterconnectionRequest { + r.createOrganizationInterconnectionRequest = &createOrganizationInterconnectionRequest + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateOrganizationInterconnectionRequest) Include(include []string) ApiCreateOrganizationInterconnectionRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateOrganizationInterconnectionRequest) Exclude(exclude []string) ApiCreateOrganizationInterconnectionRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateOrganizationInterconnectionRequest) Execute() (*Interconnection, *http.Response, error) { + return r.ApiService.CreateOrganizationInterconnectionExecute(r) +} + +/* +CreateOrganizationInterconnection Request a new interconnection for the organization + +Creates a new interconnection request. A Project ID must be specified in the request body for connections on shared ports. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId UUID of the organization + @return ApiCreateOrganizationInterconnectionRequest +*/ +func (a *InterconnectionsApiService) CreateOrganizationInterconnection(ctx context.Context, organizationId string) ApiCreateOrganizationInterconnectionRequest { + return ApiCreateOrganizationInterconnectionRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + } +} + +// Execute executes the request +// +// @return Interconnection +func (a *InterconnectionsApiService) CreateOrganizationInterconnectionExecute(r ApiCreateOrganizationInterconnectionRequest) (*Interconnection, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Interconnection + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.CreateOrganizationInterconnection") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{organization_id}/connections" + localVarPath = strings.Replace(localVarPath, "{"+"organization_id"+"}", url.PathEscape(parameterValueToString(r.organizationId, "organizationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createOrganizationInterconnectionRequest == nil { + return localVarReturnValue, nil, reportError("createOrganizationInterconnectionRequest is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createOrganizationInterconnectionRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateProjectInterconnectionRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + projectId string + createOrganizationInterconnectionRequest *CreateOrganizationInterconnectionRequest + include *[]string + exclude *[]string +} + +// Dedicated port or shared interconnection (also known as Fabric VC) creation request +func (r ApiCreateProjectInterconnectionRequest) CreateOrganizationInterconnectionRequest(createOrganizationInterconnectionRequest CreateOrganizationInterconnectionRequest) ApiCreateProjectInterconnectionRequest { + r.createOrganizationInterconnectionRequest = &createOrganizationInterconnectionRequest + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateProjectInterconnectionRequest) Include(include []string) ApiCreateProjectInterconnectionRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateProjectInterconnectionRequest) Exclude(exclude []string) ApiCreateProjectInterconnectionRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateProjectInterconnectionRequest) Execute() (*Interconnection, *http.Response, error) { + return r.ApiService.CreateProjectInterconnectionExecute(r) +} + +/* +CreateProjectInterconnection Request a new interconnection for the project's organization + +Creates a new interconnection request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId UUID of the project + @return ApiCreateProjectInterconnectionRequest +*/ +func (a *InterconnectionsApiService) CreateProjectInterconnection(ctx context.Context, projectId string) ApiCreateProjectInterconnectionRequest { + return ApiCreateProjectInterconnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return Interconnection +func (a *InterconnectionsApiService) CreateProjectInterconnectionExecute(r ApiCreateProjectInterconnectionRequest) (*Interconnection, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Interconnection + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.CreateProjectInterconnection") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{project_id}/connections" + localVarPath = strings.Replace(localVarPath, "{"+"project_id"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createOrganizationInterconnectionRequest == nil { + return localVarReturnValue, nil, reportError("createOrganizationInterconnectionRequest is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createOrganizationInterconnectionRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteInterconnectionRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + connectionId string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiDeleteInterconnectionRequest) Include(include []string) ApiDeleteInterconnectionRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiDeleteInterconnectionRequest) Exclude(exclude []string) ApiDeleteInterconnectionRequest { + r.exclude = &exclude + return r +} + +func (r ApiDeleteInterconnectionRequest) Execute() (*Interconnection, *http.Response, error) { + return r.ApiService.DeleteInterconnectionExecute(r) +} + +/* +DeleteInterconnection Delete interconnection + +Delete a interconnection, its associated ports and virtual circuits. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connectionId Interconnection UUID + @return ApiDeleteInterconnectionRequest +*/ +func (a *InterconnectionsApiService) DeleteInterconnection(ctx context.Context, connectionId string) ApiDeleteInterconnectionRequest { + return ApiDeleteInterconnectionRequest{ + ApiService: a, + ctx: ctx, + connectionId: connectionId, + } +} + +// Execute executes the request +// +// @return Interconnection +func (a *InterconnectionsApiService) DeleteInterconnectionExecute(r ApiDeleteInterconnectionRequest) (*Interconnection, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Interconnection + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.DeleteInterconnection") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections/{connection_id}" + localVarPath = strings.Replace(localVarPath, "{"+"connection_id"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteVirtualCircuitRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiDeleteVirtualCircuitRequest) Include(include []string) ApiDeleteVirtualCircuitRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiDeleteVirtualCircuitRequest) Exclude(exclude []string) ApiDeleteVirtualCircuitRequest { + r.exclude = &exclude + return r +} + +func (r ApiDeleteVirtualCircuitRequest) Execute() (*VirtualCircuit, *http.Response, error) { + return r.ApiService.DeleteVirtualCircuitExecute(r) +} + +/* +DeleteVirtualCircuit Delete a virtual circuit + +Delete a virtual circuit from a Dedicated Port. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Virtual Circuit UUID + @return ApiDeleteVirtualCircuitRequest +*/ +func (a *InterconnectionsApiService) DeleteVirtualCircuit(ctx context.Context, id string) ApiDeleteVirtualCircuitRequest { + return ApiDeleteVirtualCircuitRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VirtualCircuit +func (a *InterconnectionsApiService) DeleteVirtualCircuitExecute(r ApiDeleteVirtualCircuitRequest) (*VirtualCircuit, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualCircuit + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.DeleteVirtualCircuit") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/virtual-circuits/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetInterconnectionRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + connectionId string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiGetInterconnectionRequest) Include(include []string) ApiGetInterconnectionRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiGetInterconnectionRequest) Exclude(exclude []string) ApiGetInterconnectionRequest { + r.exclude = &exclude + return r +} + +func (r ApiGetInterconnectionRequest) Execute() (*Interconnection, *http.Response, error) { + return r.ApiService.GetInterconnectionExecute(r) +} + +/* +GetInterconnection Get interconnection + +Get the details of a interconnection + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connectionId Interconnection UUID + @return ApiGetInterconnectionRequest +*/ +func (a *InterconnectionsApiService) GetInterconnection(ctx context.Context, connectionId string) ApiGetInterconnectionRequest { + return ApiGetInterconnectionRequest{ + ApiService: a, + ctx: ctx, + connectionId: connectionId, + } +} + +// Execute executes the request +// +// @return Interconnection +func (a *InterconnectionsApiService) GetInterconnectionExecute(r ApiGetInterconnectionRequest) (*Interconnection, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Interconnection + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.GetInterconnection") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections/{connection_id}" + localVarPath = strings.Replace(localVarPath, "{"+"connection_id"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetInterconnectionPortRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + connectionId string + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiGetInterconnectionPortRequest) Include(include []string) ApiGetInterconnectionPortRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiGetInterconnectionPortRequest) Exclude(exclude []string) ApiGetInterconnectionPortRequest { + r.exclude = &exclude + return r +} + +func (r ApiGetInterconnectionPortRequest) Execute() (*InterconnectionPort, *http.Response, error) { + return r.ApiService.GetInterconnectionPortExecute(r) +} + +/* +GetInterconnectionPort Get a interconnection port + +Get the details of an interconnection port. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connectionId UUID of the interconnection + @param id Port UUID + @return ApiGetInterconnectionPortRequest +*/ +func (a *InterconnectionsApiService) GetInterconnectionPort(ctx context.Context, connectionId string, id string) ApiGetInterconnectionPortRequest { + return ApiGetInterconnectionPortRequest{ + ApiService: a, + ctx: ctx, + connectionId: connectionId, + id: id, + } +} + +// Execute executes the request +// +// @return InterconnectionPort +func (a *InterconnectionsApiService) GetInterconnectionPortExecute(r ApiGetInterconnectionPortRequest) (*InterconnectionPort, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InterconnectionPort + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.GetInterconnectionPort") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections/{connection_id}/ports/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"connection_id"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetVirtualCircuitRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiGetVirtualCircuitRequest) Include(include []string) ApiGetVirtualCircuitRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiGetVirtualCircuitRequest) Exclude(exclude []string) ApiGetVirtualCircuitRequest { + r.exclude = &exclude + return r +} + +func (r ApiGetVirtualCircuitRequest) Execute() (*VirtualCircuit, *http.Response, error) { + return r.ApiService.GetVirtualCircuitExecute(r) +} + +/* +GetVirtualCircuit Get a virtual circuit + +Get the details of a virtual circuit + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Virtual Circuit UUID + @return ApiGetVirtualCircuitRequest +*/ +func (a *InterconnectionsApiService) GetVirtualCircuit(ctx context.Context, id string) ApiGetVirtualCircuitRequest { + return ApiGetVirtualCircuitRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VirtualCircuit +func (a *InterconnectionsApiService) GetVirtualCircuitExecute(r ApiGetVirtualCircuitRequest) (*VirtualCircuit, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualCircuit + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.GetVirtualCircuit") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/virtual-circuits/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListInterconnectionPortVirtualCircuitsRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + connectionId string + portId string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiListInterconnectionPortVirtualCircuitsRequest) Include(include []string) ApiListInterconnectionPortVirtualCircuitsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiListInterconnectionPortVirtualCircuitsRequest) Exclude(exclude []string) ApiListInterconnectionPortVirtualCircuitsRequest { + r.exclude = &exclude + return r +} + +func (r ApiListInterconnectionPortVirtualCircuitsRequest) Execute() (*VirtualCircuitList, *http.Response, error) { + return r.ApiService.ListInterconnectionPortVirtualCircuitsExecute(r) +} + +/* +ListInterconnectionPortVirtualCircuits List a interconnection port's virtual circuits + +List the virtual circuit record(s) associatiated with a particular interconnection port. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connectionId UUID of the interconnection + @param portId UUID of the interconnection port + @return ApiListInterconnectionPortVirtualCircuitsRequest +*/ +func (a *InterconnectionsApiService) ListInterconnectionPortVirtualCircuits(ctx context.Context, connectionId string, portId string) ApiListInterconnectionPortVirtualCircuitsRequest { + return ApiListInterconnectionPortVirtualCircuitsRequest{ + ApiService: a, + ctx: ctx, + connectionId: connectionId, + portId: portId, + } +} + +// Execute executes the request +// +// @return VirtualCircuitList +func (a *InterconnectionsApiService) ListInterconnectionPortVirtualCircuitsExecute(r ApiListInterconnectionPortVirtualCircuitsRequest) (*VirtualCircuitList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualCircuitList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.ListInterconnectionPortVirtualCircuits") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections/{connection_id}/ports/{port_id}/virtual-circuits" + localVarPath = strings.Replace(localVarPath, "{"+"connection_id"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"port_id"+"}", url.PathEscape(parameterValueToString(r.portId, "portId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListInterconnectionPortsRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + connectionId string +} + +func (r ApiListInterconnectionPortsRequest) Execute() (*InterconnectionPortList, *http.Response, error) { + return r.ApiService.ListInterconnectionPortsExecute(r) +} + +/* +ListInterconnectionPorts List a interconnection's ports + +List the ports associated to an interconnection. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connectionId UUID of the interconnection + @return ApiListInterconnectionPortsRequest +*/ +func (a *InterconnectionsApiService) ListInterconnectionPorts(ctx context.Context, connectionId string) ApiListInterconnectionPortsRequest { + return ApiListInterconnectionPortsRequest{ + ApiService: a, + ctx: ctx, + connectionId: connectionId, + } +} + +// Execute executes the request +// +// @return InterconnectionPortList +func (a *InterconnectionsApiService) ListInterconnectionPortsExecute(r ApiListInterconnectionPortsRequest) (*InterconnectionPortList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InterconnectionPortList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.ListInterconnectionPorts") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections/{connection_id}/ports" + localVarPath = strings.Replace(localVarPath, "{"+"connection_id"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListInterconnectionVirtualCircuitsRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + connectionId string +} + +func (r ApiListInterconnectionVirtualCircuitsRequest) Execute() (*VirtualCircuitList, *http.Response, error) { + return r.ApiService.ListInterconnectionVirtualCircuitsExecute(r) +} + +/* +ListInterconnectionVirtualCircuits List a interconnection's virtual circuits + +List the virtual circuit record(s) associated with a particular interconnection id. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connectionId UUID of the interconnection + @return ApiListInterconnectionVirtualCircuitsRequest +*/ +func (a *InterconnectionsApiService) ListInterconnectionVirtualCircuits(ctx context.Context, connectionId string) ApiListInterconnectionVirtualCircuitsRequest { + return ApiListInterconnectionVirtualCircuitsRequest{ + ApiService: a, + ctx: ctx, + connectionId: connectionId, + } +} + +// Execute executes the request +// +// @return VirtualCircuitList +func (a *InterconnectionsApiService) ListInterconnectionVirtualCircuitsExecute(r ApiListInterconnectionVirtualCircuitsRequest) (*VirtualCircuitList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualCircuitList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.ListInterconnectionVirtualCircuits") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections/{connection_id}/virtual-circuits" + localVarPath = strings.Replace(localVarPath, "{"+"connection_id"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiOrganizationListInterconnectionsRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + organizationId string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiOrganizationListInterconnectionsRequest) Include(include []string) ApiOrganizationListInterconnectionsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiOrganizationListInterconnectionsRequest) Exclude(exclude []string) ApiOrganizationListInterconnectionsRequest { + r.exclude = &exclude + return r +} + +func (r ApiOrganizationListInterconnectionsRequest) Execute() (*InterconnectionList, *http.Response, error) { + return r.ApiService.OrganizationListInterconnectionsExecute(r) +} + +/* +OrganizationListInterconnections List organization connections + +List the connections belonging to the organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId UUID of the organization + @return ApiOrganizationListInterconnectionsRequest +*/ +func (a *InterconnectionsApiService) OrganizationListInterconnections(ctx context.Context, organizationId string) ApiOrganizationListInterconnectionsRequest { + return ApiOrganizationListInterconnectionsRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + } +} + +// Execute executes the request +// +// @return InterconnectionList +func (a *InterconnectionsApiService) OrganizationListInterconnectionsExecute(r ApiOrganizationListInterconnectionsRequest) (*InterconnectionList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InterconnectionList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.OrganizationListInterconnections") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{organization_id}/connections" + localVarPath = strings.Replace(localVarPath, "{"+"organization_id"+"}", url.PathEscape(parameterValueToString(r.organizationId, "organizationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiProjectListInterconnectionsRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + projectId string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiProjectListInterconnectionsRequest) Include(include []string) ApiProjectListInterconnectionsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiProjectListInterconnectionsRequest) Exclude(exclude []string) ApiProjectListInterconnectionsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiProjectListInterconnectionsRequest) Page(page int32) ApiProjectListInterconnectionsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiProjectListInterconnectionsRequest) PerPage(perPage int32) ApiProjectListInterconnectionsRequest { + r.perPage = &perPage + return r +} + +func (r ApiProjectListInterconnectionsRequest) Execute() (*InterconnectionList, *http.Response, error) { + return r.ApiService.ProjectListInterconnectionsExecute(r) +} + +/* +ProjectListInterconnections List project connections + +List the connections belonging to the project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId UUID of the project + @return ApiProjectListInterconnectionsRequest +*/ +func (a *InterconnectionsApiService) ProjectListInterconnections(ctx context.Context, projectId string) ApiProjectListInterconnectionsRequest { + return ApiProjectListInterconnectionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return InterconnectionList +func (a *InterconnectionsApiService) ProjectListInterconnectionsExecute(r ApiProjectListInterconnectionsRequest) (*InterconnectionList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InterconnectionList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.ProjectListInterconnections") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{project_id}/connections" + localVarPath = strings.Replace(localVarPath, "{"+"project_id"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return InterconnectionList +func (r ApiProjectListInterconnectionsRequest) ExecuteWithPagination() (*InterconnectionList, error) { + + var items InterconnectionList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Interconnections = append(items.Interconnections, page.Interconnections...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiUpdateInterconnectionRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + connectionId string + interconnectionUpdateInput *InterconnectionUpdateInput + include *[]string + exclude *[]string +} + +// Updated interconnection details +func (r ApiUpdateInterconnectionRequest) InterconnectionUpdateInput(interconnectionUpdateInput InterconnectionUpdateInput) ApiUpdateInterconnectionRequest { + r.interconnectionUpdateInput = &interconnectionUpdateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateInterconnectionRequest) Include(include []string) ApiUpdateInterconnectionRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiUpdateInterconnectionRequest) Exclude(exclude []string) ApiUpdateInterconnectionRequest { + r.exclude = &exclude + return r +} + +func (r ApiUpdateInterconnectionRequest) Execute() (*Interconnection, *http.Response, error) { + return r.ApiService.UpdateInterconnectionExecute(r) +} + +/* +UpdateInterconnection Update interconnection + +Update the details of a interconnection + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connectionId Interconnection UUID + @return ApiUpdateInterconnectionRequest +*/ +func (a *InterconnectionsApiService) UpdateInterconnection(ctx context.Context, connectionId string) ApiUpdateInterconnectionRequest { + return ApiUpdateInterconnectionRequest{ + ApiService: a, + ctx: ctx, + connectionId: connectionId, + } +} + +// Execute executes the request +// +// @return Interconnection +func (a *InterconnectionsApiService) UpdateInterconnectionExecute(r ApiUpdateInterconnectionRequest) (*Interconnection, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Interconnection + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.UpdateInterconnection") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connections/{connection_id}" + localVarPath = strings.Replace(localVarPath, "{"+"connection_id"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.interconnectionUpdateInput == nil { + return localVarReturnValue, nil, reportError("interconnectionUpdateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.interconnectionUpdateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateVirtualCircuitRequest struct { + ctx context.Context + ApiService *InterconnectionsApiService + id string + virtualCircuitUpdateInput *VirtualCircuitUpdateInput + include *[]string + exclude *[]string +} + +// Updated Virtual Circuit details +func (r ApiUpdateVirtualCircuitRequest) VirtualCircuitUpdateInput(virtualCircuitUpdateInput VirtualCircuitUpdateInput) ApiUpdateVirtualCircuitRequest { + r.virtualCircuitUpdateInput = &virtualCircuitUpdateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateVirtualCircuitRequest) Include(include []string) ApiUpdateVirtualCircuitRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiUpdateVirtualCircuitRequest) Exclude(exclude []string) ApiUpdateVirtualCircuitRequest { + r.exclude = &exclude + return r +} + +func (r ApiUpdateVirtualCircuitRequest) Execute() (*VirtualCircuit, *http.Response, error) { + return r.ApiService.UpdateVirtualCircuitExecute(r) +} + +/* +UpdateVirtualCircuit Update a virtual circuit + +Update the details of a virtual circuit. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Virtual Circuit UUID + @return ApiUpdateVirtualCircuitRequest +*/ +func (a *InterconnectionsApiService) UpdateVirtualCircuit(ctx context.Context, id string) ApiUpdateVirtualCircuitRequest { + return ApiUpdateVirtualCircuitRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VirtualCircuit +func (a *InterconnectionsApiService) UpdateVirtualCircuitExecute(r ApiUpdateVirtualCircuitRequest) (*VirtualCircuit, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualCircuit + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InterconnectionsApiService.UpdateVirtualCircuit") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/virtual-circuits/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.virtualCircuitUpdateInput == nil { + return localVarReturnValue, nil, reportError("virtualCircuitUpdateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.virtualCircuitUpdateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_invitations.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_invitations.go new file mode 100644 index 00000000..a0102cc4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_invitations.go @@ -0,0 +1,482 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// InvitationsApiService InvitationsApi service +type InvitationsApiService service + +type ApiAcceptInvitationRequest struct { + ctx context.Context + ApiService *InvitationsApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiAcceptInvitationRequest) Include(include []string) ApiAcceptInvitationRequest { + r.include = &include + return r +} + +func (r ApiAcceptInvitationRequest) Execute() (*Membership, *http.Response, error) { + return r.ApiService.AcceptInvitationExecute(r) +} + +/* +AcceptInvitation Accept an invitation + +Accept an invitation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Invitation UUID + @return ApiAcceptInvitationRequest +*/ +func (a *InvitationsApiService) AcceptInvitation(ctx context.Context, id string) ApiAcceptInvitationRequest { + return ApiAcceptInvitationRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Membership +func (a *InvitationsApiService) AcceptInvitationExecute(r ApiAcceptInvitationRequest) (*Membership, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Membership + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InvitationsApiService.AcceptInvitation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/invitations/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeclineInvitationRequest struct { + ctx context.Context + ApiService *InvitationsApiService + id string +} + +func (r ApiDeclineInvitationRequest) Execute() (*http.Response, error) { + return r.ApiService.DeclineInvitationExecute(r) +} + +/* +DeclineInvitation Decline an invitation + +Decline an invitation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Invitation UUID + @return ApiDeclineInvitationRequest +*/ +func (a *InvitationsApiService) DeclineInvitation(ctx context.Context, id string) ApiDeclineInvitationRequest { + return ApiDeclineInvitationRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *InvitationsApiService) DeclineInvitationExecute(r ApiDeclineInvitationRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InvitationsApiService.DeclineInvitation") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/invitations/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindInvitationByIdRequest struct { + ctx context.Context + ApiService *InvitationsApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindInvitationByIdRequest) Include(include []string) ApiFindInvitationByIdRequest { + r.include = &include + return r +} + +func (r ApiFindInvitationByIdRequest) Execute() (*Invitation, *http.Response, error) { + return r.ApiService.FindInvitationByIdExecute(r) +} + +/* +FindInvitationById View an invitation + +Returns a single invitation. (It include the `invitable` to maintain backward compatibility but will be removed soon) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Invitation UUID + @return ApiFindInvitationByIdRequest +*/ +func (a *InvitationsApiService) FindInvitationById(ctx context.Context, id string) ApiFindInvitationByIdRequest { + return ApiFindInvitationByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Invitation +func (a *InvitationsApiService) FindInvitationByIdExecute(r ApiFindInvitationByIdRequest) (*Invitation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Invitation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InvitationsApiService.FindInvitationById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/invitations/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_invoices.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_invoices.go new file mode 100644 index 00000000..d6951a82 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_invoices.go @@ -0,0 +1,332 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// InvoicesApiService InvoicesApi service +type InvoicesApiService service + +type ApiFindOrganizationInvoicesRequest struct { + ctx context.Context + ApiService *InvoicesApiService + id string + page *int32 + perPage *int32 + status *string +} + +// page number +func (r ApiFindOrganizationInvoicesRequest) Page(page int32) ApiFindOrganizationInvoicesRequest { + r.page = &page + return r +} + +// per page +func (r ApiFindOrganizationInvoicesRequest) PerPage(perPage int32) ApiFindOrganizationInvoicesRequest { + r.perPage = &perPage + return r +} + +// filter by status +func (r ApiFindOrganizationInvoicesRequest) Status(status string) ApiFindOrganizationInvoicesRequest { + r.status = &status + return r +} + +func (r ApiFindOrganizationInvoicesRequest) Execute() (*InvoiceList, *http.Response, error) { + return r.ApiService.FindOrganizationInvoicesExecute(r) +} + +/* +FindOrganizationInvoices Retrieve all invoices for an organization + +Returns all invoices for an organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOrganizationInvoicesRequest +*/ +func (a *InvoicesApiService) FindOrganizationInvoices(ctx context.Context, id string) ApiFindOrganizationInvoicesRequest { + return ApiFindOrganizationInvoicesRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return InvoiceList +func (a *InvoicesApiService) FindOrganizationInvoicesExecute(r ApiFindOrganizationInvoicesRequest) (*InvoiceList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InvoiceList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InvoicesApiService.FindOrganizationInvoices") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/invoices" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + if r.status != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "status", r.status, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetInvoiceByIdRequest struct { + ctx context.Context + ApiService *InvoicesApiService + id string +} + +func (r ApiGetInvoiceByIdRequest) Execute() (*Invoice, *http.Response, error) { + return r.ApiService.GetInvoiceByIdExecute(r) +} + +/* +GetInvoiceById Retrieve an invoice + +Returns the invoice identified by the provided id + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Invoice UUID + @return ApiGetInvoiceByIdRequest +*/ +func (a *InvoicesApiService) GetInvoiceById(ctx context.Context, id string) ApiGetInvoiceByIdRequest { + return ApiGetInvoiceByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Invoice +func (a *InvoicesApiService) GetInvoiceByIdExecute(r ApiGetInvoiceByIdRequest) (*Invoice, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Invoice + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InvoicesApiService.GetInvoiceById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/invoices/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ip_addresses.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ip_addresses.go new file mode 100644 index 00000000..15cf8514 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ip_addresses.go @@ -0,0 +1,1235 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// IPAddressesApiService IPAddressesApi service +type IPAddressesApiService service + +type ApiDeleteIPAddressRequest struct { + ctx context.Context + ApiService *IPAddressesApiService + id string +} + +func (r ApiDeleteIPAddressRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteIPAddressExecute(r) +} + +/* +DeleteIPAddress Unassign an ip address + +This call can be used to un-assign an IP assignment or delete +an IP reservation. + +Un-assign an IP address record. +Use the assignment UUID you +get after attaching the IP. This will remove the relationship between an IP and the device or metal gateway and will make the IP address available to be assigned to another device, once the IP has been un-configured from the network. + +Delete an IP reservation. +Use the reservation UUID you get after adding the IP to the project. This will permanently delete the IP block reservation from the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id IP Address UUID + @return ApiDeleteIPAddressRequest +*/ +func (a *IPAddressesApiService) DeleteIPAddress(ctx context.Context, id string) ApiDeleteIPAddressRequest { + return ApiDeleteIPAddressRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *IPAddressesApiService) DeleteIPAddressExecute(r ApiDeleteIPAddressRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPAddressesApiService.DeleteIPAddress") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindIPAddressByIdRequest struct { + ctx context.Context + ApiService *IPAddressesApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindIPAddressByIdRequest) Include(include []string) ApiFindIPAddressByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindIPAddressByIdRequest) Exclude(exclude []string) ApiFindIPAddressByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindIPAddressByIdRequest) Execute() (*FindIPAddressById200Response, *http.Response, error) { + return r.ApiService.FindIPAddressByIdExecute(r) +} + +/* +FindIPAddressById Retrieve an ip address + +Returns a single ip address if the user has access. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id IP Address UUID + @return ApiFindIPAddressByIdRequest +*/ +func (a *IPAddressesApiService) FindIPAddressById(ctx context.Context, id string) ApiFindIPAddressByIdRequest { + return ApiFindIPAddressByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return FindIPAddressById200Response +func (a *IPAddressesApiService) FindIPAddressByIdExecute(r ApiFindIPAddressByIdRequest) (*FindIPAddressById200Response, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FindIPAddressById200Response + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPAddressesApiService.FindIPAddressById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindIPAddressCustomdataRequest struct { + ctx context.Context + ApiService *IPAddressesApiService + id string +} + +func (r ApiFindIPAddressCustomdataRequest) Execute() (*http.Response, error) { + return r.ApiService.FindIPAddressCustomdataExecute(r) +} + +/* +FindIPAddressCustomdata Retrieve the custom metadata of an IP Reservation or IP Assignment + +Provides the custom metadata stored for this IP Reservation or IP Assignment in json format + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Ip Reservation UUID + @return ApiFindIPAddressCustomdataRequest +*/ +func (a *IPAddressesApiService) FindIPAddressCustomdata(ctx context.Context, id string) ApiFindIPAddressCustomdataRequest { + return ApiFindIPAddressCustomdataRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *IPAddressesApiService) FindIPAddressCustomdataExecute(r ApiFindIPAddressCustomdataRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPAddressesApiService.FindIPAddressCustomdata") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips/{id}/customdata" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindIPAvailabilitiesRequest struct { + ctx context.Context + ApiService *IPAddressesApiService + id string + cidr *FindIPAvailabilitiesCidrParameter +} + +// Size of subnets in bits +func (r ApiFindIPAvailabilitiesRequest) Cidr(cidr FindIPAvailabilitiesCidrParameter) ApiFindIPAvailabilitiesRequest { + r.cidr = &cidr + return r +} + +func (r ApiFindIPAvailabilitiesRequest) Execute() (*IPAvailabilitiesList, *http.Response, error) { + return r.ApiService.FindIPAvailabilitiesExecute(r) +} + +/* +FindIPAvailabilities Retrieve all available subnets of a particular reservation + +Provides a list of IP resevations for a single project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id IP Reservation UUID + @return ApiFindIPAvailabilitiesRequest +*/ +func (a *IPAddressesApiService) FindIPAvailabilities(ctx context.Context, id string) ApiFindIPAvailabilitiesRequest { + return ApiFindIPAvailabilitiesRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return IPAvailabilitiesList +func (a *IPAddressesApiService) FindIPAvailabilitiesExecute(r ApiFindIPAvailabilitiesRequest) (*IPAvailabilitiesList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IPAvailabilitiesList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPAddressesApiService.FindIPAvailabilities") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips/{id}/available" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.cidr == nil { + return localVarReturnValue, nil, reportError("cidr is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "cidr", r.cidr, "") + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindIPReservationsRequest struct { + ctx context.Context + ApiService *IPAddressesApiService + id string + types *[]FindIPReservationsTypesParameterInner + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Filter project IP reservations by reservation type +func (r ApiFindIPReservationsRequest) Types(types []FindIPReservationsTypesParameterInner) ApiFindIPReservationsRequest { + r.types = &types + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindIPReservationsRequest) Include(include []string) ApiFindIPReservationsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindIPReservationsRequest) Exclude(exclude []string) ApiFindIPReservationsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindIPReservationsRequest) Page(page int32) ApiFindIPReservationsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindIPReservationsRequest) PerPage(perPage int32) ApiFindIPReservationsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindIPReservationsRequest) Execute() (*IPReservationList, *http.Response, error) { + return r.ApiService.FindIPReservationsExecute(r) +} + +/* +FindIPReservations Retrieve all ip reservations + +Provides a paginated list of IP reservations for a single project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindIPReservationsRequest +*/ +func (a *IPAddressesApiService) FindIPReservations(ctx context.Context, id string) ApiFindIPReservationsRequest { + return ApiFindIPReservationsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return IPReservationList +func (a *IPAddressesApiService) FindIPReservationsExecute(r ApiFindIPReservationsRequest) (*IPReservationList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IPReservationList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPAddressesApiService.FindIPReservations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/ips" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.types != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "types", r.types, "csv") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return IPReservationList +func (r ApiFindIPReservationsRequest) ExecuteWithPagination() (*IPReservationList, error) { + + var items IPReservationList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.IpAddresses = append(items.IpAddresses, page.IpAddresses...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiRequestIPReservationRequest struct { + ctx context.Context + ApiService *IPAddressesApiService + id string + requestIPReservationRequest *RequestIPReservationRequest + include *[]string + exclude *[]string +} + +// IP Reservation Request to create +func (r ApiRequestIPReservationRequest) RequestIPReservationRequest(requestIPReservationRequest RequestIPReservationRequest) ApiRequestIPReservationRequest { + r.requestIPReservationRequest = &requestIPReservationRequest + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiRequestIPReservationRequest) Include(include []string) ApiRequestIPReservationRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiRequestIPReservationRequest) Exclude(exclude []string) ApiRequestIPReservationRequest { + r.exclude = &exclude + return r +} + +func (r ApiRequestIPReservationRequest) Execute() (*RequestIPReservation201Response, *http.Response, error) { + return r.ApiService.RequestIPReservationExecute(r) +} + +/* +RequestIPReservation Requesting IP reservations + +Request more IP space for a project in order to have additional IP addresses to assign to devices. If the request is within the max quota, an IP reservation will be created. If the project will exceed its IP quota, a request will be submitted for review, and will return an IP Reservation with a `state` of `pending`. You can automatically have the request fail with HTTP status 422 instead of triggering the review process by providing the `fail_on_approval_required` parameter set to `true` in the request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiRequestIPReservationRequest +*/ +func (a *IPAddressesApiService) RequestIPReservation(ctx context.Context, id string) ApiRequestIPReservationRequest { + return ApiRequestIPReservationRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return RequestIPReservation201Response +func (a *IPAddressesApiService) RequestIPReservationExecute(r ApiRequestIPReservationRequest) (*RequestIPReservation201Response, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RequestIPReservation201Response + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPAddressesApiService.RequestIPReservation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/ips" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.requestIPReservationRequest == nil { + return localVarReturnValue, nil, reportError("requestIPReservationRequest is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.requestIPReservationRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateIPAddressRequest struct { + ctx context.Context + ApiService *IPAddressesApiService + id string + include *[]string + exclude *[]string + iPAssignmentUpdateInput *IPAssignmentUpdateInput +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateIPAddressRequest) Include(include []string) ApiUpdateIPAddressRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiUpdateIPAddressRequest) Exclude(exclude []string) ApiUpdateIPAddressRequest { + r.exclude = &exclude + return r +} + +func (r ApiUpdateIPAddressRequest) IPAssignmentUpdateInput(iPAssignmentUpdateInput IPAssignmentUpdateInput) ApiUpdateIPAddressRequest { + r.iPAssignmentUpdateInput = &iPAssignmentUpdateInput + return r +} + +func (r ApiUpdateIPAddressRequest) Execute() (*FindIPAddressById200Response, *http.Response, error) { + return r.ApiService.UpdateIPAddressExecute(r) +} + +/* +UpdateIPAddress Update an ip address + +Update details about an ip address + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id IP Address UUID + @return ApiUpdateIPAddressRequest +*/ +func (a *IPAddressesApiService) UpdateIPAddress(ctx context.Context, id string) ApiUpdateIPAddressRequest { + return ApiUpdateIPAddressRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return FindIPAddressById200Response +func (a *IPAddressesApiService) UpdateIPAddressExecute(r ApiUpdateIPAddressRequest) (*FindIPAddressById200Response, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FindIPAddressById200Response + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPAddressesApiService.UpdateIPAddress") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.iPAssignmentUpdateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_licenses.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_licenses.go new file mode 100644 index 00000000..53810137 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_licenses.go @@ -0,0 +1,908 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// LicensesApiService LicensesApi service +type LicensesApiService service + +type ApiCreateLicenseRequest struct { + ctx context.Context + ApiService *LicensesApiService + id string + licenseCreateInput *LicenseCreateInput + include *[]string + exclude *[]string +} + +// License to create +func (r ApiCreateLicenseRequest) LicenseCreateInput(licenseCreateInput LicenseCreateInput) ApiCreateLicenseRequest { + r.licenseCreateInput = &licenseCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateLicenseRequest) Include(include []string) ApiCreateLicenseRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateLicenseRequest) Exclude(exclude []string) ApiCreateLicenseRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateLicenseRequest) Execute() (*License, *http.Response, error) { + return r.ApiService.CreateLicenseExecute(r) +} + +/* +CreateLicense Create a License + +Creates a new license for the given project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiCreateLicenseRequest +*/ +func (a *LicensesApiService) CreateLicense(ctx context.Context, id string) ApiCreateLicenseRequest { + return ApiCreateLicenseRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return License +func (a *LicensesApiService) CreateLicenseExecute(r ApiCreateLicenseRequest) (*License, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *License + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LicensesApiService.CreateLicense") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/licenses" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.licenseCreateInput == nil { + return localVarReturnValue, nil, reportError("licenseCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.licenseCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteLicenseRequest struct { + ctx context.Context + ApiService *LicensesApiService + id string +} + +func (r ApiDeleteLicenseRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteLicenseExecute(r) +} + +/* +DeleteLicense Delete the license + +Deletes a license. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id License UUID + @return ApiDeleteLicenseRequest +*/ +func (a *LicensesApiService) DeleteLicense(ctx context.Context, id string) ApiDeleteLicenseRequest { + return ApiDeleteLicenseRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *LicensesApiService) DeleteLicenseExecute(r ApiDeleteLicenseRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LicensesApiService.DeleteLicense") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/licenses/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindLicenseByIdRequest struct { + ctx context.Context + ApiService *LicensesApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindLicenseByIdRequest) Include(include []string) ApiFindLicenseByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindLicenseByIdRequest) Exclude(exclude []string) ApiFindLicenseByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindLicenseByIdRequest) Execute() (*License, *http.Response, error) { + return r.ApiService.FindLicenseByIdExecute(r) +} + +/* +FindLicenseById Retrieve a license + +Returns a license + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id License UUID + @return ApiFindLicenseByIdRequest +*/ +func (a *LicensesApiService) FindLicenseById(ctx context.Context, id string) ApiFindLicenseByIdRequest { + return ApiFindLicenseByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return License +func (a *LicensesApiService) FindLicenseByIdExecute(r ApiFindLicenseByIdRequest) (*License, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *License + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LicensesApiService.FindLicenseById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/licenses/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindProjectLicensesRequest struct { + ctx context.Context + ApiService *LicensesApiService + id string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindProjectLicensesRequest) Include(include []string) ApiFindProjectLicensesRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindProjectLicensesRequest) Exclude(exclude []string) ApiFindProjectLicensesRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindProjectLicensesRequest) Page(page int32) ApiFindProjectLicensesRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindProjectLicensesRequest) PerPage(perPage int32) ApiFindProjectLicensesRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindProjectLicensesRequest) Execute() (*LicenseList, *http.Response, error) { + return r.ApiService.FindProjectLicensesExecute(r) +} + +/* +FindProjectLicenses Retrieve all licenses + +Provides a collection of licenses for a given project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindProjectLicensesRequest +*/ +func (a *LicensesApiService) FindProjectLicenses(ctx context.Context, id string) ApiFindProjectLicensesRequest { + return ApiFindProjectLicensesRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return LicenseList +func (a *LicensesApiService) FindProjectLicensesExecute(r ApiFindProjectLicensesRequest) (*LicenseList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LicenseList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LicensesApiService.FindProjectLicenses") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/licenses" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateLicenseRequest struct { + ctx context.Context + ApiService *LicensesApiService + id string + licenseUpdateInput *LicenseUpdateInput + include *[]string + exclude *[]string +} + +// License to update +func (r ApiUpdateLicenseRequest) LicenseUpdateInput(licenseUpdateInput LicenseUpdateInput) ApiUpdateLicenseRequest { + r.licenseUpdateInput = &licenseUpdateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateLicenseRequest) Include(include []string) ApiUpdateLicenseRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiUpdateLicenseRequest) Exclude(exclude []string) ApiUpdateLicenseRequest { + r.exclude = &exclude + return r +} + +func (r ApiUpdateLicenseRequest) Execute() (*License, *http.Response, error) { + return r.ApiService.UpdateLicenseExecute(r) +} + +/* +UpdateLicense Update the license + +Updates the license. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id License UUID + @return ApiUpdateLicenseRequest +*/ +func (a *LicensesApiService) UpdateLicense(ctx context.Context, id string) ApiUpdateLicenseRequest { + return ApiUpdateLicenseRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return License +func (a *LicensesApiService) UpdateLicenseExecute(r ApiUpdateLicenseRequest) (*License, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *License + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LicensesApiService.UpdateLicense") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/licenses/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.licenseUpdateInput == nil { + return localVarReturnValue, nil, reportError("licenseUpdateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.licenseUpdateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_memberships.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_memberships.go new file mode 100644 index 00000000..0da96f4e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_memberships.go @@ -0,0 +1,505 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// MembershipsApiService MembershipsApi service +type MembershipsApiService service + +type ApiDeleteMembershipRequest struct { + ctx context.Context + ApiService *MembershipsApiService + id string +} + +func (r ApiDeleteMembershipRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteMembershipExecute(r) +} + +/* +DeleteMembership Delete the membership + +Deletes the membership. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Membership UUID + @return ApiDeleteMembershipRequest +*/ +func (a *MembershipsApiService) DeleteMembership(ctx context.Context, id string) ApiDeleteMembershipRequest { + return ApiDeleteMembershipRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *MembershipsApiService) DeleteMembershipExecute(r ApiDeleteMembershipRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MembershipsApiService.DeleteMembership") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/memberships/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindMembershipByIdRequest struct { + ctx context.Context + ApiService *MembershipsApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindMembershipByIdRequest) Include(include []string) ApiFindMembershipByIdRequest { + r.include = &include + return r +} + +func (r ApiFindMembershipByIdRequest) Execute() (*Membership, *http.Response, error) { + return r.ApiService.FindMembershipByIdExecute(r) +} + +/* +FindMembershipById Retrieve a membership + +Returns a single membership. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Membership UUID + @return ApiFindMembershipByIdRequest +*/ +func (a *MembershipsApiService) FindMembershipById(ctx context.Context, id string) ApiFindMembershipByIdRequest { + return ApiFindMembershipByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Membership +func (a *MembershipsApiService) FindMembershipByIdExecute(r ApiFindMembershipByIdRequest) (*Membership, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Membership + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MembershipsApiService.FindMembershipById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/memberships/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateMembershipRequest struct { + ctx context.Context + ApiService *MembershipsApiService + id string + membershipInput *MembershipInput + include *[]string +} + +// Membership to update +func (r ApiUpdateMembershipRequest) MembershipInput(membershipInput MembershipInput) ApiUpdateMembershipRequest { + r.membershipInput = &membershipInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateMembershipRequest) Include(include []string) ApiUpdateMembershipRequest { + r.include = &include + return r +} + +func (r ApiUpdateMembershipRequest) Execute() (*Membership, *http.Response, error) { + return r.ApiService.UpdateMembershipExecute(r) +} + +/* +UpdateMembership Update the membership + +Updates the membership. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Membership UUID + @return ApiUpdateMembershipRequest +*/ +func (a *MembershipsApiService) UpdateMembership(ctx context.Context, id string) ApiUpdateMembershipRequest { + return ApiUpdateMembershipRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Membership +func (a *MembershipsApiService) UpdateMembershipExecute(r ApiUpdateMembershipRequest) (*Membership, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Membership + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MembershipsApiService.UpdateMembership") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/memberships/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.membershipInput == nil { + return localVarReturnValue, nil, reportError("membershipInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.membershipInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_metal_gateways.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_metal_gateways.go new file mode 100644 index 00000000..dec1375c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_metal_gateways.go @@ -0,0 +1,1103 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// MetalGatewaysApiService MetalGatewaysApi service +type MetalGatewaysApiService service + +type ApiCreateMetalGatewayRequest struct { + ctx context.Context + ApiService *MetalGatewaysApiService + projectId string + createMetalGatewayRequest *CreateMetalGatewayRequest + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Metal Gateway to create +func (r ApiCreateMetalGatewayRequest) CreateMetalGatewayRequest(createMetalGatewayRequest CreateMetalGatewayRequest) ApiCreateMetalGatewayRequest { + r.createMetalGatewayRequest = &createMetalGatewayRequest + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateMetalGatewayRequest) Include(include []string) ApiCreateMetalGatewayRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateMetalGatewayRequest) Exclude(exclude []string) ApiCreateMetalGatewayRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiCreateMetalGatewayRequest) Page(page int32) ApiCreateMetalGatewayRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiCreateMetalGatewayRequest) PerPage(perPage int32) ApiCreateMetalGatewayRequest { + r.perPage = &perPage + return r +} + +func (r ApiCreateMetalGatewayRequest) Execute() (*FindMetalGatewayById200Response, *http.Response, error) { + return r.ApiService.CreateMetalGatewayExecute(r) +} + +/* +CreateMetalGateway Create a metal gateway + +Create a metal gateway in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project UUID + @return ApiCreateMetalGatewayRequest +*/ +func (a *MetalGatewaysApiService) CreateMetalGateway(ctx context.Context, projectId string) ApiCreateMetalGatewayRequest { + return ApiCreateMetalGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return FindMetalGatewayById200Response +func (a *MetalGatewaysApiService) CreateMetalGatewayExecute(r ApiCreateMetalGatewayRequest) (*FindMetalGatewayById200Response, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FindMetalGatewayById200Response + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetalGatewaysApiService.CreateMetalGateway") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{project_id}/metal-gateways" + localVarPath = strings.Replace(localVarPath, "{"+"project_id"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createMetalGatewayRequest == nil { + return localVarReturnValue, nil, reportError("createMetalGatewayRequest is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createMetalGatewayRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateMetalGatewayElasticIpRequest struct { + ctx context.Context + ApiService *MetalGatewaysApiService + id string + metalGatewayElasticIpCreateInput *MetalGatewayElasticIpCreateInput + include *[]string + exclude *[]string +} + +func (r ApiCreateMetalGatewayElasticIpRequest) MetalGatewayElasticIpCreateInput(metalGatewayElasticIpCreateInput MetalGatewayElasticIpCreateInput) ApiCreateMetalGatewayElasticIpRequest { + r.metalGatewayElasticIpCreateInput = &metalGatewayElasticIpCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateMetalGatewayElasticIpRequest) Include(include []string) ApiCreateMetalGatewayElasticIpRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateMetalGatewayElasticIpRequest) Exclude(exclude []string) ApiCreateMetalGatewayElasticIpRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateMetalGatewayElasticIpRequest) Execute() (*IPAssignment, *http.Response, error) { + return r.ApiService.CreateMetalGatewayElasticIpExecute(r) +} + +/* +CreateMetalGatewayElasticIp Create a Metal Gateway Elastic IP + +Create a new Elastic IP on this Metal Gateway. + +Assign an IPv4 range as an elastic IP to the Metal Gateway, with a specified next-hop address contained within the Metal Gateway. + +Notice: Elastic IPs on Metal Gateways are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Metal Gateway UUID + @return ApiCreateMetalGatewayElasticIpRequest +*/ +func (a *MetalGatewaysApiService) CreateMetalGatewayElasticIp(ctx context.Context, id string) ApiCreateMetalGatewayElasticIpRequest { + return ApiCreateMetalGatewayElasticIpRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return IPAssignment +func (a *MetalGatewaysApiService) CreateMetalGatewayElasticIpExecute(r ApiCreateMetalGatewayElasticIpRequest) (*IPAssignment, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IPAssignment + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetalGatewaysApiService.CreateMetalGatewayElasticIp") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metal-gateways/{id}/ips" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.metalGatewayElasticIpCreateInput == nil { + return localVarReturnValue, nil, reportError("metalGatewayElasticIpCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.metalGatewayElasticIpCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteMetalGatewayRequest struct { + ctx context.Context + ApiService *MetalGatewaysApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiDeleteMetalGatewayRequest) Include(include []string) ApiDeleteMetalGatewayRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiDeleteMetalGatewayRequest) Exclude(exclude []string) ApiDeleteMetalGatewayRequest { + r.exclude = &exclude + return r +} + +func (r ApiDeleteMetalGatewayRequest) Execute() (*FindMetalGatewayById200Response, *http.Response, error) { + return r.ApiService.DeleteMetalGatewayExecute(r) +} + +/* +DeleteMetalGateway Deletes the metal gateway + +Deletes a metal gateway and any elastic IP assignments associated with this metal gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Metal Gateway UUID + @return ApiDeleteMetalGatewayRequest +*/ +func (a *MetalGatewaysApiService) DeleteMetalGateway(ctx context.Context, id string) ApiDeleteMetalGatewayRequest { + return ApiDeleteMetalGatewayRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return FindMetalGatewayById200Response +func (a *MetalGatewaysApiService) DeleteMetalGatewayExecute(r ApiDeleteMetalGatewayRequest) (*FindMetalGatewayById200Response, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FindMetalGatewayById200Response + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetalGatewaysApiService.DeleteMetalGateway") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metal-gateways/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindMetalGatewayByIdRequest struct { + ctx context.Context + ApiService *MetalGatewaysApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindMetalGatewayByIdRequest) Include(include []string) ApiFindMetalGatewayByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindMetalGatewayByIdRequest) Exclude(exclude []string) ApiFindMetalGatewayByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindMetalGatewayByIdRequest) Execute() (*FindMetalGatewayById200Response, *http.Response, error) { + return r.ApiService.FindMetalGatewayByIdExecute(r) +} + +/* +FindMetalGatewayById Returns the metal gateway + +Returns a specific metal gateway + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Metal Gateway UUID + @return ApiFindMetalGatewayByIdRequest +*/ +func (a *MetalGatewaysApiService) FindMetalGatewayById(ctx context.Context, id string) ApiFindMetalGatewayByIdRequest { + return ApiFindMetalGatewayByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return FindMetalGatewayById200Response +func (a *MetalGatewaysApiService) FindMetalGatewayByIdExecute(r ApiFindMetalGatewayByIdRequest) (*FindMetalGatewayById200Response, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FindMetalGatewayById200Response + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetalGatewaysApiService.FindMetalGatewayById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metal-gateways/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindMetalGatewaysByProjectRequest struct { + ctx context.Context + ApiService *MetalGatewaysApiService + projectId string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindMetalGatewaysByProjectRequest) Include(include []string) ApiFindMetalGatewaysByProjectRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindMetalGatewaysByProjectRequest) Exclude(exclude []string) ApiFindMetalGatewaysByProjectRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindMetalGatewaysByProjectRequest) Page(page int32) ApiFindMetalGatewaysByProjectRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindMetalGatewaysByProjectRequest) PerPage(perPage int32) ApiFindMetalGatewaysByProjectRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindMetalGatewaysByProjectRequest) Execute() (*MetalGatewayList, *http.Response, error) { + return r.ApiService.FindMetalGatewaysByProjectExecute(r) +} + +/* +FindMetalGatewaysByProject Returns all metal gateways for a project + +Return all metal gateways for a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project UUID + @return ApiFindMetalGatewaysByProjectRequest +*/ +func (a *MetalGatewaysApiService) FindMetalGatewaysByProject(ctx context.Context, projectId string) ApiFindMetalGatewaysByProjectRequest { + return ApiFindMetalGatewaysByProjectRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return MetalGatewayList +func (a *MetalGatewaysApiService) FindMetalGatewaysByProjectExecute(r ApiFindMetalGatewaysByProjectRequest) (*MetalGatewayList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MetalGatewayList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetalGatewaysApiService.FindMetalGatewaysByProject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{project_id}/metal-gateways" + localVarPath = strings.Replace(localVarPath, "{"+"project_id"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return MetalGatewayList +func (r ApiFindMetalGatewaysByProjectRequest) ExecuteWithPagination() (*MetalGatewayList, error) { + + var items MetalGatewayList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.MetalGateways = append(items.MetalGateways, page.MetalGateways...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiGetMetalGatewayElasticIpsRequest struct { + ctx context.Context + ApiService *MetalGatewaysApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiGetMetalGatewayElasticIpsRequest) Include(include []string) ApiGetMetalGatewayElasticIpsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiGetMetalGatewayElasticIpsRequest) Exclude(exclude []string) ApiGetMetalGatewayElasticIpsRequest { + r.exclude = &exclude + return r +} + +func (r ApiGetMetalGatewayElasticIpsRequest) Execute() (*IPAssignmentList, *http.Response, error) { + return r.ApiService.GetMetalGatewayElasticIpsExecute(r) +} + +/* +GetMetalGatewayElasticIps List Metal Gateway Elastic IPs + +Returns the list of Elastic IPs assigned to this Metal Gateway + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Metal Gateway UUID + @return ApiGetMetalGatewayElasticIpsRequest +*/ +func (a *MetalGatewaysApiService) GetMetalGatewayElasticIps(ctx context.Context, id string) ApiGetMetalGatewayElasticIpsRequest { + return ApiGetMetalGatewayElasticIpsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return IPAssignmentList +func (a *MetalGatewaysApiService) GetMetalGatewayElasticIpsExecute(r ApiGetMetalGatewayElasticIpsRequest) (*IPAssignmentList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IPAssignmentList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetalGatewaysApiService.GetMetalGatewayElasticIps") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metal-gateways/{id}/ips" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_metros.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_metros.go new file mode 100644 index 00000000..585b1867 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_metros.go @@ -0,0 +1,276 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// MetrosApiService MetrosApi service +type MetrosApiService service + +type ApiFindMetrosRequest struct { + ctx context.Context + ApiService *MetrosApiService +} + +func (r ApiFindMetrosRequest) Execute() (*MetroList, *http.Response, error) { + return r.ApiService.FindMetrosExecute(r) +} + +/* +FindMetros Retrieve all metros + +Provides a listing of available metros + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindMetrosRequest +*/ +func (a *MetrosApiService) FindMetros(ctx context.Context) ApiFindMetrosRequest { + return ApiFindMetrosRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return MetroList +func (a *MetrosApiService) FindMetrosExecute(r ApiFindMetrosRequest) (*MetroList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MetroList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetrosApiService.FindMetros") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/locations/metros" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetMetroRequest struct { + ctx context.Context + ApiService *MetrosApiService + id string +} + +func (r ApiGetMetroRequest) Execute() (*Metro, *http.Response, error) { + return r.ApiService.GetMetroExecute(r) +} + +/* +GetMetro Retrieve a specific Metro's details + +Show the details for a metro, including name, code, and country. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Metro UUID + @return ApiGetMetroRequest +*/ +func (a *MetrosApiService) GetMetro(ctx context.Context, id string) ApiGetMetroRequest { + return ApiGetMetroRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Metro +func (a *MetrosApiService) GetMetroExecute(r ApiGetMetroRequest) (*Metro, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Metro + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetrosApiService.GetMetro") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/locations/metros/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_operating_systems.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_operating_systems.go new file mode 100644 index 00000000..93416f59 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_operating_systems.go @@ -0,0 +1,271 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +// OperatingSystemsApiService OperatingSystemsApi service +type OperatingSystemsApiService service + +type ApiFindOperatingSystemVersionRequest struct { + ctx context.Context + ApiService *OperatingSystemsApiService +} + +func (r ApiFindOperatingSystemVersionRequest) Execute() (*OperatingSystemList, *http.Response, error) { + return r.ApiService.FindOperatingSystemVersionExecute(r) +} + +/* +FindOperatingSystemVersion Retrieve all operating system versions + +Provides a listing of available operating system versions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindOperatingSystemVersionRequest +*/ +func (a *OperatingSystemsApiService) FindOperatingSystemVersion(ctx context.Context) ApiFindOperatingSystemVersionRequest { + return ApiFindOperatingSystemVersionRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return OperatingSystemList +func (a *OperatingSystemsApiService) FindOperatingSystemVersionExecute(r ApiFindOperatingSystemVersionRequest) (*OperatingSystemList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *OperatingSystemList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OperatingSystemsApiService.FindOperatingSystemVersion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/operating-system-versions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindOperatingSystemsRequest struct { + ctx context.Context + ApiService *OperatingSystemsApiService +} + +func (r ApiFindOperatingSystemsRequest) Execute() (*OperatingSystemList, *http.Response, error) { + return r.ApiService.FindOperatingSystemsExecute(r) +} + +/* +FindOperatingSystems Retrieve all operating systems + +Provides a listing of available operating systems to provision your new device with. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindOperatingSystemsRequest +*/ +func (a *OperatingSystemsApiService) FindOperatingSystems(ctx context.Context) ApiFindOperatingSystemsRequest { + return ApiFindOperatingSystemsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return OperatingSystemList +func (a *OperatingSystemsApiService) FindOperatingSystemsExecute(r ApiFindOperatingSystemsRequest) (*OperatingSystemList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *OperatingSystemList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OperatingSystemsApiService.FindOperatingSystems") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/operating-systems" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_organizations.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_organizations.go new file mode 100644 index 00000000..fd6a706a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_organizations.go @@ -0,0 +1,2597 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// OrganizationsApiService OrganizationsApi service +type OrganizationsApiService service + +type ApiCreateOrganizationRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + organizationInput *OrganizationInput + include *[]string + exclude *[]string +} + +// Organization to create +func (r ApiCreateOrganizationRequest) OrganizationInput(organizationInput OrganizationInput) ApiCreateOrganizationRequest { + r.organizationInput = &organizationInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateOrganizationRequest) Include(include []string) ApiCreateOrganizationRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateOrganizationRequest) Exclude(exclude []string) ApiCreateOrganizationRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateOrganizationRequest) Execute() (*Organization, *http.Response, error) { + return r.ApiService.CreateOrganizationExecute(r) +} + +/* +CreateOrganization Create an organization + +Creates an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateOrganizationRequest +*/ +func (a *OrganizationsApiService) CreateOrganization(ctx context.Context) ApiCreateOrganizationRequest { + return ApiCreateOrganizationRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return Organization +func (a *OrganizationsApiService) CreateOrganizationExecute(r ApiCreateOrganizationRequest) (*Organization, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Organization + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.CreateOrganization") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.organizationInput == nil { + return localVarReturnValue, nil, reportError("organizationInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.organizationInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateOrganizationInvitationRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string + invitationInput *InvitationInput + include *[]string +} + +// Invitation to create +func (r ApiCreateOrganizationInvitationRequest) InvitationInput(invitationInput InvitationInput) ApiCreateOrganizationInvitationRequest { + r.invitationInput = &invitationInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateOrganizationInvitationRequest) Include(include []string) ApiCreateOrganizationInvitationRequest { + r.include = &include + return r +} + +func (r ApiCreateOrganizationInvitationRequest) Execute() (*Invitation, *http.Response, error) { + return r.ApiService.CreateOrganizationInvitationExecute(r) +} + +/* +CreateOrganizationInvitation Create an invitation for an organization + +In order to add a user to an organization, they must first be invited. +To invite to several projects the parameter `projects_ids:[a,b,c]` can be used + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiCreateOrganizationInvitationRequest +*/ +func (a *OrganizationsApiService) CreateOrganizationInvitation(ctx context.Context, id string) ApiCreateOrganizationInvitationRequest { + return ApiCreateOrganizationInvitationRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Invitation +func (a *OrganizationsApiService) CreateOrganizationInvitationExecute(r ApiCreateOrganizationInvitationRequest) (*Invitation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Invitation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.CreateOrganizationInvitation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/invitations" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.invitationInput == nil { + return localVarReturnValue, nil, reportError("invitationInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.invitationInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateOrganizationProjectRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string + projectCreateInput *ProjectCreateInput + include *[]string + exclude *[]string +} + +// Project to create +func (r ApiCreateOrganizationProjectRequest) ProjectCreateInput(projectCreateInput ProjectCreateInput) ApiCreateOrganizationProjectRequest { + r.projectCreateInput = &projectCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateOrganizationProjectRequest) Include(include []string) ApiCreateOrganizationProjectRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateOrganizationProjectRequest) Exclude(exclude []string) ApiCreateOrganizationProjectRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateOrganizationProjectRequest) Execute() (*Project, *http.Response, error) { + return r.ApiService.CreateOrganizationProjectExecute(r) +} + +/* +CreateOrganizationProject Create a project for the organization + +Creates a new project for the organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiCreateOrganizationProjectRequest +*/ +func (a *OrganizationsApiService) CreateOrganizationProject(ctx context.Context, id string) ApiCreateOrganizationProjectRequest { + return ApiCreateOrganizationProjectRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Project +func (a *OrganizationsApiService) CreateOrganizationProjectExecute(r ApiCreateOrganizationProjectRequest) (*Project, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Project + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.CreateOrganizationProject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/projects" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.projectCreateInput == nil { + return localVarReturnValue, nil, reportError("projectCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.projectCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreatePaymentMethodRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string + paymentMethodCreateInput *PaymentMethodCreateInput + include *[]string +} + +// Payment Method to create +func (r ApiCreatePaymentMethodRequest) PaymentMethodCreateInput(paymentMethodCreateInput PaymentMethodCreateInput) ApiCreatePaymentMethodRequest { + r.paymentMethodCreateInput = &paymentMethodCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreatePaymentMethodRequest) Include(include []string) ApiCreatePaymentMethodRequest { + r.include = &include + return r +} + +func (r ApiCreatePaymentMethodRequest) Execute() (*PaymentMethod, *http.Response, error) { + return r.ApiService.CreatePaymentMethodExecute(r) +} + +/* +CreatePaymentMethod Create a payment method for the given organization + +Creates a payment method. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiCreatePaymentMethodRequest +*/ +func (a *OrganizationsApiService) CreatePaymentMethod(ctx context.Context, id string) ApiCreatePaymentMethodRequest { + return ApiCreatePaymentMethodRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return PaymentMethod +func (a *OrganizationsApiService) CreatePaymentMethodExecute(r ApiCreatePaymentMethodRequest) (*PaymentMethod, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PaymentMethod + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.CreatePaymentMethod") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/payment-methods" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.paymentMethodCreateInput == nil { + return localVarReturnValue, nil, reportError("paymentMethodCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.paymentMethodCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteOrganizationRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string +} + +func (r ApiDeleteOrganizationRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteOrganizationExecute(r) +} + +/* +DeleteOrganization Delete the organization + +Deletes the organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiDeleteOrganizationRequest +*/ +func (a *OrganizationsApiService) DeleteOrganization(ctx context.Context, id string) ApiDeleteOrganizationRequest { + return ApiDeleteOrganizationRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *OrganizationsApiService) DeleteOrganizationExecute(r ApiDeleteOrganizationRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.DeleteOrganization") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindOperatingSystemsByOrganizationRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindOperatingSystemsByOrganizationRequest) Include(include []string) ApiFindOperatingSystemsByOrganizationRequest { + r.include = &include + return r +} + +func (r ApiFindOperatingSystemsByOrganizationRequest) Execute() (*OperatingSystemList, *http.Response, error) { + return r.ApiService.FindOperatingSystemsByOrganizationExecute(r) +} + +/* +FindOperatingSystemsByOrganization Retrieve all operating systems visible by the organization + +Returns a listing of available operating systems for the given organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOperatingSystemsByOrganizationRequest +*/ +func (a *OrganizationsApiService) FindOperatingSystemsByOrganization(ctx context.Context, id string) ApiFindOperatingSystemsByOrganizationRequest { + return ApiFindOperatingSystemsByOrganizationRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return OperatingSystemList +func (a *OrganizationsApiService) FindOperatingSystemsByOrganizationExecute(r ApiFindOperatingSystemsByOrganizationRequest) (*OperatingSystemList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *OperatingSystemList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.FindOperatingSystemsByOrganization") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/operating-systems" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindOrganizationByIdRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindOrganizationByIdRequest) Include(include []string) ApiFindOrganizationByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindOrganizationByIdRequest) Exclude(exclude []string) ApiFindOrganizationByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindOrganizationByIdRequest) Execute() (*Organization, *http.Response, error) { + return r.ApiService.FindOrganizationByIdExecute(r) +} + +/* +FindOrganizationById Retrieve an organization's details + +Returns a single organization's details, if the user is authorized to view it. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOrganizationByIdRequest +*/ +func (a *OrganizationsApiService) FindOrganizationById(ctx context.Context, id string) ApiFindOrganizationByIdRequest { + return ApiFindOrganizationByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Organization +func (a *OrganizationsApiService) FindOrganizationByIdExecute(r ApiFindOrganizationByIdRequest) (*Organization, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Organization + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.FindOrganizationById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindOrganizationCustomdataRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string +} + +func (r ApiFindOrganizationCustomdataRequest) Execute() (*http.Response, error) { + return r.ApiService.FindOrganizationCustomdataExecute(r) +} + +/* +FindOrganizationCustomdata Retrieve the custom metadata of an organization + +Provides the custom metadata stored for this organization in json format + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOrganizationCustomdataRequest +*/ +func (a *OrganizationsApiService) FindOrganizationCustomdata(ctx context.Context, id string) ApiFindOrganizationCustomdataRequest { + return ApiFindOrganizationCustomdataRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *OrganizationsApiService) FindOrganizationCustomdataExecute(r ApiFindOrganizationCustomdataRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.FindOrganizationCustomdata") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/customdata" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindOrganizationInvitationsRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string + include *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindOrganizationInvitationsRequest) Include(include []string) ApiFindOrganizationInvitationsRequest { + r.include = &include + return r +} + +// Page to return +func (r ApiFindOrganizationInvitationsRequest) Page(page int32) ApiFindOrganizationInvitationsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindOrganizationInvitationsRequest) PerPage(perPage int32) ApiFindOrganizationInvitationsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindOrganizationInvitationsRequest) Execute() (*InvitationList, *http.Response, error) { + return r.ApiService.FindOrganizationInvitationsExecute(r) +} + +/* +FindOrganizationInvitations Retrieve organization invitations + +Returns all invitations in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOrganizationInvitationsRequest +*/ +func (a *OrganizationsApiService) FindOrganizationInvitations(ctx context.Context, id string) ApiFindOrganizationInvitationsRequest { + return ApiFindOrganizationInvitationsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return InvitationList +func (a *OrganizationsApiService) FindOrganizationInvitationsExecute(r ApiFindOrganizationInvitationsRequest) (*InvitationList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InvitationList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.FindOrganizationInvitations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/invitations" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindOrganizationPaymentMethodsRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string + include *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindOrganizationPaymentMethodsRequest) Include(include []string) ApiFindOrganizationPaymentMethodsRequest { + r.include = &include + return r +} + +// Page to return +func (r ApiFindOrganizationPaymentMethodsRequest) Page(page int32) ApiFindOrganizationPaymentMethodsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindOrganizationPaymentMethodsRequest) PerPage(perPage int32) ApiFindOrganizationPaymentMethodsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindOrganizationPaymentMethodsRequest) Execute() (*PaymentMethodList, *http.Response, error) { + return r.ApiService.FindOrganizationPaymentMethodsExecute(r) +} + +/* +FindOrganizationPaymentMethods Retrieve all payment methods of an organization + +Returns all payment methods of an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOrganizationPaymentMethodsRequest +*/ +func (a *OrganizationsApiService) FindOrganizationPaymentMethods(ctx context.Context, id string) ApiFindOrganizationPaymentMethodsRequest { + return ApiFindOrganizationPaymentMethodsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return PaymentMethodList +func (a *OrganizationsApiService) FindOrganizationPaymentMethodsExecute(r ApiFindOrganizationPaymentMethodsRequest) (*PaymentMethodList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PaymentMethodList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.FindOrganizationPaymentMethods") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/payment-methods" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindOrganizationProjectsRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string + name *string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Filter results by name. +func (r ApiFindOrganizationProjectsRequest) Name(name string) ApiFindOrganizationProjectsRequest { + r.name = &name + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindOrganizationProjectsRequest) Include(include []string) ApiFindOrganizationProjectsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindOrganizationProjectsRequest) Exclude(exclude []string) ApiFindOrganizationProjectsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindOrganizationProjectsRequest) Page(page int32) ApiFindOrganizationProjectsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindOrganizationProjectsRequest) PerPage(perPage int32) ApiFindOrganizationProjectsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindOrganizationProjectsRequest) Execute() (*ProjectList, *http.Response, error) { + return r.ApiService.FindOrganizationProjectsExecute(r) +} + +/* +FindOrganizationProjects Retrieve all projects of an organization + +Returns a collection of projects that belong to the organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOrganizationProjectsRequest +*/ +func (a *OrganizationsApiService) FindOrganizationProjects(ctx context.Context, id string) ApiFindOrganizationProjectsRequest { + return ApiFindOrganizationProjectsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return ProjectList +func (a *OrganizationsApiService) FindOrganizationProjectsExecute(r ApiFindOrganizationProjectsRequest) (*ProjectList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ProjectList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.FindOrganizationProjects") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/projects" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.name != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return ProjectList +func (r ApiFindOrganizationProjectsRequest) ExecuteWithPagination() (*ProjectList, error) { + + var items ProjectList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Projects = append(items.Projects, page.Projects...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiFindOrganizationTransfersRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindOrganizationTransfersRequest) Include(include []string) ApiFindOrganizationTransfersRequest { + r.include = &include + return r +} + +func (r ApiFindOrganizationTransfersRequest) Execute() (*TransferRequestList, *http.Response, error) { + return r.ApiService.FindOrganizationTransfersExecute(r) +} + +/* +FindOrganizationTransfers Retrieve all project transfer requests from or to an organization + +Provides a collection of project transfer requests from or to the organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindOrganizationTransfersRequest +*/ +func (a *OrganizationsApiService) FindOrganizationTransfers(ctx context.Context, id string) ApiFindOrganizationTransfersRequest { + return ApiFindOrganizationTransfersRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return TransferRequestList +func (a *OrganizationsApiService) FindOrganizationTransfersExecute(r ApiFindOrganizationTransfersRequest) (*TransferRequestList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TransferRequestList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.FindOrganizationTransfers") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/transfers" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindOrganizationsRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + personal *FindOrganizationsPersonalParameter + withoutProjects *FindOrganizationsPersonalParameter + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Include, exclude or show only personal organizations. +func (r ApiFindOrganizationsRequest) Personal(personal FindOrganizationsPersonalParameter) ApiFindOrganizationsRequest { + r.personal = &personal + return r +} + +// Include, exclude or show only organizations that have no projects. +func (r ApiFindOrganizationsRequest) WithoutProjects(withoutProjects FindOrganizationsPersonalParameter) ApiFindOrganizationsRequest { + r.withoutProjects = &withoutProjects + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindOrganizationsRequest) Include(include []string) ApiFindOrganizationsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindOrganizationsRequest) Exclude(exclude []string) ApiFindOrganizationsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindOrganizationsRequest) Page(page int32) ApiFindOrganizationsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindOrganizationsRequest) PerPage(perPage int32) ApiFindOrganizationsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindOrganizationsRequest) Execute() (*OrganizationList, *http.Response, error) { + return r.ApiService.FindOrganizationsExecute(r) +} + +/* +FindOrganizations Retrieve all organizations + +Returns a list of organizations that are accessible to the current user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindOrganizationsRequest +*/ +func (a *OrganizationsApiService) FindOrganizations(ctx context.Context) ApiFindOrganizationsRequest { + return ApiFindOrganizationsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return OrganizationList +func (a *OrganizationsApiService) FindOrganizationsExecute(r ApiFindOrganizationsRequest) (*OrganizationList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *OrganizationList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.FindOrganizations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.personal != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "personal", r.personal, "") + } + if r.withoutProjects != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "without_projects", r.withoutProjects, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return OrganizationList +func (r ApiFindOrganizationsRequest) ExecuteWithPagination() (*OrganizationList, error) { + + var items OrganizationList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Organizations = append(items.Organizations, page.Organizations...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiFindPlansByOrganizationRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindPlansByOrganizationRequest) Include(include []string) ApiFindPlansByOrganizationRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindPlansByOrganizationRequest) Exclude(exclude []string) ApiFindPlansByOrganizationRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindPlansByOrganizationRequest) Execute() (*PlanList, *http.Response, error) { + return r.ApiService.FindPlansByOrganizationExecute(r) +} + +/* +FindPlansByOrganization Retrieve all plans visible by the organization + +Returns a listing of available plans for the given organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiFindPlansByOrganizationRequest +*/ +func (a *OrganizationsApiService) FindPlansByOrganization(ctx context.Context, id string) ApiFindPlansByOrganizationRequest { + return ApiFindPlansByOrganizationRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return PlanList +func (a *OrganizationsApiService) FindPlansByOrganizationExecute(r ApiFindPlansByOrganizationRequest) (*PlanList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PlanList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.FindPlansByOrganization") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}/plans" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateOrganizationRequest struct { + ctx context.Context + ApiService *OrganizationsApiService + id string + organizationInput *OrganizationInput + include *[]string + exclude *[]string +} + +// Organization to update +func (r ApiUpdateOrganizationRequest) OrganizationInput(organizationInput OrganizationInput) ApiUpdateOrganizationRequest { + r.organizationInput = &organizationInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateOrganizationRequest) Include(include []string) ApiUpdateOrganizationRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiUpdateOrganizationRequest) Exclude(exclude []string) ApiUpdateOrganizationRequest { + r.exclude = &exclude + return r +} + +func (r ApiUpdateOrganizationRequest) Execute() (*Organization, *http.Response, error) { + return r.ApiService.UpdateOrganizationExecute(r) +} + +/* +UpdateOrganization Update the organization + +Updates the organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Organization UUID + @return ApiUpdateOrganizationRequest +*/ +func (a *OrganizationsApiService) UpdateOrganization(ctx context.Context, id string) ApiUpdateOrganizationRequest { + return ApiUpdateOrganizationRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Organization +func (a *OrganizationsApiService) UpdateOrganizationExecute(r ApiUpdateOrganizationRequest) (*Organization, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Organization + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.UpdateOrganization") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/organizations/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.organizationInput == nil { + return localVarReturnValue, nil, reportError("organizationInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.organizationInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_otps.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_otps.go new file mode 100644 index 00000000..940292f1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_otps.go @@ -0,0 +1,745 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// OTPsApiService OTPsApi service +type OTPsApiService service + +type ApiFindEnsureOtpRequest struct { + ctx context.Context + ApiService *OTPsApiService + otp string +} + +func (r ApiFindEnsureOtpRequest) Execute() (*http.Response, error) { + return r.ApiService.FindEnsureOtpExecute(r) +} + +/* +FindEnsureOtp Verify user by providing an OTP + +It verifies the user once a valid OTP is provided. It gives back a session token, essentially logging in the user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param otp OTP + @return ApiFindEnsureOtpRequest +*/ +func (a *OTPsApiService) FindEnsureOtp(ctx context.Context, otp string) ApiFindEnsureOtpRequest { + return ApiFindEnsureOtpRequest{ + ApiService: a, + ctx: ctx, + otp: otp, + } +} + +// Execute executes the request +func (a *OTPsApiService) FindEnsureOtpExecute(r ApiFindEnsureOtpRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OTPsApiService.FindEnsureOtp") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/otp/verify/{otp}" + localVarPath = strings.Replace(localVarPath, "{"+"otp"+"}", url.PathEscape(parameterValueToString(r.otp, "otp")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindRecoveryCodesRequest struct { + ctx context.Context + ApiService *OTPsApiService +} + +func (r ApiFindRecoveryCodesRequest) Execute() (*RecoveryCodeList, *http.Response, error) { + return r.ApiService.FindRecoveryCodesExecute(r) +} + +/* +FindRecoveryCodes Retrieve my recovery codes + +Returns my recovery codes. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindRecoveryCodesRequest +*/ +func (a *OTPsApiService) FindRecoveryCodes(ctx context.Context) ApiFindRecoveryCodesRequest { + return ApiFindRecoveryCodesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return RecoveryCodeList +func (a *OTPsApiService) FindRecoveryCodesExecute(r ApiFindRecoveryCodesRequest) (*RecoveryCodeList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryCodeList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OTPsApiService.FindRecoveryCodes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/otp/recovery-codes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiReceiveCodesRequest struct { + ctx context.Context + ApiService *OTPsApiService +} + +func (r ApiReceiveCodesRequest) Execute() (*http.Response, error) { + return r.ApiService.ReceiveCodesExecute(r) +} + +/* +ReceiveCodes Receive an OTP per sms + +Sends an OTP to the user's mobile phone. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiReceiveCodesRequest +*/ +func (a *OTPsApiService) ReceiveCodes(ctx context.Context) ApiReceiveCodesRequest { + return ApiReceiveCodesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *OTPsApiService) ReceiveCodesExecute(r ApiReceiveCodesRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OTPsApiService.ReceiveCodes") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/otp/sms/receive" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiRegenerateCodesRequest struct { + ctx context.Context + ApiService *OTPsApiService +} + +func (r ApiRegenerateCodesRequest) Execute() (*RecoveryCodeList, *http.Response, error) { + return r.ApiService.RegenerateCodesExecute(r) +} + +/* +RegenerateCodes Generate new recovery codes + +Generate a new set of recovery codes. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiRegenerateCodesRequest +*/ +func (a *OTPsApiService) RegenerateCodes(ctx context.Context) ApiRegenerateCodesRequest { + return ApiRegenerateCodesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return RecoveryCodeList +func (a *OTPsApiService) RegenerateCodesExecute(r ApiRegenerateCodesRequest) (*RecoveryCodeList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecoveryCodeList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OTPsApiService.RegenerateCodes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/otp/recovery-codes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSeedAppRequest struct { + ctx context.Context + ApiService *OTPsApiService +} + +func (r ApiSeedAppRequest) Execute() (*OtpSeed, *http.Response, error) { + return r.ApiService.SeedAppExecute(r) +} + +/* +SeedApp Issue OTP seeds + +Issues OTP seeds for the user to upload to their 2FA app + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSeedAppRequest +*/ +func (a *OTPsApiService) SeedApp(ctx context.Context) ApiSeedAppRequest { + return ApiSeedAppRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return OtpSeed +func (a *OTPsApiService) SeedAppExecute(r ApiSeedAppRequest) (*OtpSeed, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *OtpSeed + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OTPsApiService.SeedApp") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/otp/app/receive" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_password_reset_tokens.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_password_reset_tokens.go new file mode 100644 index 00000000..07cec9b3 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_password_reset_tokens.go @@ -0,0 +1,292 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +// PasswordResetTokensApiService PasswordResetTokensApi service +type PasswordResetTokensApiService service + +type ApiCreatePasswordResetTokenRequest struct { + ctx context.Context + ApiService *PasswordResetTokensApiService + email *string +} + +// Email of user to create password reset token +func (r ApiCreatePasswordResetTokenRequest) Email(email string) ApiCreatePasswordResetTokenRequest { + r.email = &email + return r +} + +func (r ApiCreatePasswordResetTokenRequest) Execute() (*http.Response, error) { + return r.ApiService.CreatePasswordResetTokenExecute(r) +} + +/* +CreatePasswordResetToken Create a password reset token + +Creates a password reset token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreatePasswordResetTokenRequest +*/ +func (a *PasswordResetTokensApiService) CreatePasswordResetToken(ctx context.Context) ApiCreatePasswordResetTokenRequest { + return ApiCreatePasswordResetTokenRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *PasswordResetTokensApiService) CreatePasswordResetTokenExecute(r ApiCreatePasswordResetTokenRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PasswordResetTokensApiService.CreatePasswordResetToken") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/reset-password" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.email == nil { + return nil, reportError("email is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "email", r.email, "") + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiResetPasswordRequest struct { + ctx context.Context + ApiService *PasswordResetTokensApiService +} + +func (r ApiResetPasswordRequest) Execute() (*NewPassword, *http.Response, error) { + return r.ApiService.ResetPasswordExecute(r) +} + +/* +ResetPassword Reset current user password + +Resets current user password. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiResetPasswordRequest +*/ +func (a *PasswordResetTokensApiService) ResetPassword(ctx context.Context) ApiResetPasswordRequest { + return ApiResetPasswordRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return NewPassword +func (a *PasswordResetTokensApiService) ResetPasswordExecute(r ApiResetPasswordRequest) (*NewPassword, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NewPassword + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PasswordResetTokensApiService.ResetPassword") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/reset-password" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_payment_methods.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_payment_methods.go new file mode 100644 index 00000000..33bffa36 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_payment_methods.go @@ -0,0 +1,472 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// PaymentMethodsApiService PaymentMethodsApi service +type PaymentMethodsApiService service + +type ApiDeletePaymentMethodRequest struct { + ctx context.Context + ApiService *PaymentMethodsApiService + id string +} + +func (r ApiDeletePaymentMethodRequest) Execute() (*http.Response, error) { + return r.ApiService.DeletePaymentMethodExecute(r) +} + +/* +DeletePaymentMethod Delete the payment method + +Deletes the payment method. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Payment Method UUID + @return ApiDeletePaymentMethodRequest +*/ +func (a *PaymentMethodsApiService) DeletePaymentMethod(ctx context.Context, id string) ApiDeletePaymentMethodRequest { + return ApiDeletePaymentMethodRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *PaymentMethodsApiService) DeletePaymentMethodExecute(r ApiDeletePaymentMethodRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentMethodsApiService.DeletePaymentMethod") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/payment-methods/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindPaymentMethodByIdRequest struct { + ctx context.Context + ApiService *PaymentMethodsApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindPaymentMethodByIdRequest) Include(include []string) ApiFindPaymentMethodByIdRequest { + r.include = &include + return r +} + +func (r ApiFindPaymentMethodByIdRequest) Execute() (*PaymentMethod, *http.Response, error) { + return r.ApiService.FindPaymentMethodByIdExecute(r) +} + +/* +FindPaymentMethodById Retrieve a payment method + +Returns a payment method + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Payment Method UUID + @return ApiFindPaymentMethodByIdRequest +*/ +func (a *PaymentMethodsApiService) FindPaymentMethodById(ctx context.Context, id string) ApiFindPaymentMethodByIdRequest { + return ApiFindPaymentMethodByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return PaymentMethod +func (a *PaymentMethodsApiService) FindPaymentMethodByIdExecute(r ApiFindPaymentMethodByIdRequest) (*PaymentMethod, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PaymentMethod + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentMethodsApiService.FindPaymentMethodById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/payment-methods/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdatePaymentMethodRequest struct { + ctx context.Context + ApiService *PaymentMethodsApiService + id string + paymentMethodUpdateInput *PaymentMethodUpdateInput + include *[]string +} + +// Payment Method to update +func (r ApiUpdatePaymentMethodRequest) PaymentMethodUpdateInput(paymentMethodUpdateInput PaymentMethodUpdateInput) ApiUpdatePaymentMethodRequest { + r.paymentMethodUpdateInput = &paymentMethodUpdateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdatePaymentMethodRequest) Include(include []string) ApiUpdatePaymentMethodRequest { + r.include = &include + return r +} + +func (r ApiUpdatePaymentMethodRequest) Execute() (*PaymentMethod, *http.Response, error) { + return r.ApiService.UpdatePaymentMethodExecute(r) +} + +/* +UpdatePaymentMethod Update the payment method + +Updates the payment method. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Payment Method UUID + @return ApiUpdatePaymentMethodRequest +*/ +func (a *PaymentMethodsApiService) UpdatePaymentMethod(ctx context.Context, id string) ApiUpdatePaymentMethodRequest { + return ApiUpdatePaymentMethodRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return PaymentMethod +func (a *PaymentMethodsApiService) UpdatePaymentMethodExecute(r ApiUpdatePaymentMethodRequest) (*PaymentMethod, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PaymentMethod + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentMethodsApiService.UpdatePaymentMethod") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/payment-methods/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.paymentMethodUpdateInput == nil { + return localVarReturnValue, nil, reportError("paymentMethodUpdateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.paymentMethodUpdateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_plans.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_plans.go new file mode 100644 index 00000000..3f8081e9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_plans.go @@ -0,0 +1,368 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// PlansApiService PlansApi service +type PlansApiService service + +type ApiFindPlansRequest struct { + ctx context.Context + ApiService *PlansApiService + categories *[]FindOrganizationDevicesCategoriesParameterInner + type_ *FindPlansTypeParameter + slug *string + include *[]string + exclude *[]string +} + +// Filter plans by its category +func (r ApiFindPlansRequest) Categories(categories []FindOrganizationDevicesCategoriesParameterInner) ApiFindPlansRequest { + r.categories = &categories + return r +} + +// Filter plans by its plan type +func (r ApiFindPlansRequest) Type_(type_ FindPlansTypeParameter) ApiFindPlansRequest { + r.type_ = &type_ + return r +} + +// Filter plans by slug +func (r ApiFindPlansRequest) Slug(slug string) ApiFindPlansRequest { + r.slug = &slug + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindPlansRequest) Include(include []string) ApiFindPlansRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindPlansRequest) Exclude(exclude []string) ApiFindPlansRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindPlansRequest) Execute() (*PlanList, *http.Response, error) { + return r.ApiService.FindPlansExecute(r) +} + +/* +FindPlans Retrieve all plans + +Provides a listing of available plans to provision your device on. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindPlansRequest +*/ +func (a *PlansApiService) FindPlans(ctx context.Context) ApiFindPlansRequest { + return ApiFindPlansRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return PlanList +func (a *PlansApiService) FindPlansExecute(r ApiFindPlansRequest) (*PlanList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PlanList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PlansApiService.FindPlans") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/plans" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.categories != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "categories", r.categories, "csv") + } + if r.type_ != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "type", r.type_, "") + } + if r.slug != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "slug", r.slug, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindPlansByProjectRequest struct { + ctx context.Context + ApiService *PlansApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindPlansByProjectRequest) Include(include []string) ApiFindPlansByProjectRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindPlansByProjectRequest) Exclude(exclude []string) ApiFindPlansByProjectRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindPlansByProjectRequest) Execute() (*PlanList, *http.Response, error) { + return r.ApiService.FindPlansByProjectExecute(r) +} + +/* +FindPlansByProject Retrieve all plans visible by the project + +Returns a listing of available plans for the given project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindPlansByProjectRequest +*/ +func (a *PlansApiService) FindPlansByProject(ctx context.Context, id string) ApiFindPlansByProjectRequest { + return ApiFindPlansByProjectRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return PlanList +func (a *PlansApiService) FindPlansByProjectExecute(r ApiFindPlansByProjectRequest) (*PlanList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PlanList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PlansApiService.FindPlansByProject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/plans" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ports.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ports.go new file mode 100644 index 00000000..236e3df4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ports.go @@ -0,0 +1,2416 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// PortsApiService PortsApi service +type PortsApiService service + +type ApiAssignNativeVlanRequest struct { + ctx context.Context + ApiService *PortsApiService + id string + vnid *string + include *[]string +} + +// Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). +func (r ApiAssignNativeVlanRequest) Vnid(vnid string) ApiAssignNativeVlanRequest { + r.vnid = &vnid + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiAssignNativeVlanRequest) Include(include []string) ApiAssignNativeVlanRequest { + r.include = &include + return r +} + +func (r ApiAssignNativeVlanRequest) Execute() (*Port, *http.Response, error) { + return r.ApiService.AssignNativeVlanExecute(r) +} + +/* +AssignNativeVlan Assign a native VLAN + +Sets a virtual network on this port as a "native VLAN". The VLAN must have already been assigned using the using the "Assign a port to a virtual network" operation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiAssignNativeVlanRequest +*/ +func (a *PortsApiService) AssignNativeVlan(ctx context.Context, id string) ApiAssignNativeVlanRequest { + return ApiAssignNativeVlanRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Port +func (a *PortsApiService) AssignNativeVlanExecute(r ApiAssignNativeVlanRequest) (*Port, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Port + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.AssignNativeVlan") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/native-vlan" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.vnid == nil { + return localVarReturnValue, nil, reportError("vnid is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "vnid", r.vnid, "") + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiAssignPortRequest struct { + ctx context.Context + ApiService *PortsApiService + id string + portAssignInput *PortAssignInput + include *[]string +} + +// Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). +func (r ApiAssignPortRequest) PortAssignInput(portAssignInput PortAssignInput) ApiAssignPortRequest { + r.portAssignInput = &portAssignInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiAssignPortRequest) Include(include []string) ApiAssignPortRequest { + r.include = &include + return r +} + +func (r ApiAssignPortRequest) Execute() (*Port, *http.Response, error) { + return r.ApiService.AssignPortExecute(r) +} + +/* +AssignPort Assign a port to virtual network + +Assign a hardware port to a virtual network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiAssignPortRequest +*/ +func (a *PortsApiService) AssignPort(ctx context.Context, id string) ApiAssignPortRequest { + return ApiAssignPortRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Port +func (a *PortsApiService) AssignPortExecute(r ApiAssignPortRequest) (*Port, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Port + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.AssignPort") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/assign" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.portAssignInput == nil { + return localVarReturnValue, nil, reportError("portAssignInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.portAssignInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBondPortRequest struct { + ctx context.Context + ApiService *PortsApiService + id string + bulkEnable *bool + include *[]string +} + +// enable both ports +func (r ApiBondPortRequest) BulkEnable(bulkEnable bool) ApiBondPortRequest { + r.bulkEnable = &bulkEnable + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiBondPortRequest) Include(include []string) ApiBondPortRequest { + r.include = &include + return r +} + +func (r ApiBondPortRequest) Execute() (*Port, *http.Response, error) { + return r.ApiService.BondPortExecute(r) +} + +/* +BondPort Enabling bonding + +Enabling bonding for one or all ports + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiBondPortRequest +*/ +func (a *PortsApiService) BondPort(ctx context.Context, id string) ApiBondPortRequest { + return ApiBondPortRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Port +func (a *PortsApiService) BondPortExecute(r ApiBondPortRequest) (*Port, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Port + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.BondPort") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/bond" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.bulkEnable != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "bulk_enable", r.bulkEnable, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiConvertLayer2Request struct { + ctx context.Context + ApiService *PortsApiService + id string + portAssignInput *PortAssignInput + include *[]string +} + +// Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). +func (r ApiConvertLayer2Request) PortAssignInput(portAssignInput PortAssignInput) ApiConvertLayer2Request { + r.portAssignInput = &portAssignInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiConvertLayer2Request) Include(include []string) ApiConvertLayer2Request { + r.include = &include + return r +} + +func (r ApiConvertLayer2Request) Execute() (*Port, *http.Response, error) { + return r.ApiService.ConvertLayer2Execute(r) +} + +/* +ConvertLayer2 Convert to Layer 2 + +Converts a bond port to Layer 2. IP assignments of the port will be removed. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiConvertLayer2Request +*/ +func (a *PortsApiService) ConvertLayer2(ctx context.Context, id string) ApiConvertLayer2Request { + return ApiConvertLayer2Request{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Port +func (a *PortsApiService) ConvertLayer2Execute(r ApiConvertLayer2Request) (*Port, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Port + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.ConvertLayer2") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/convert/layer-2" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.portAssignInput == nil { + return localVarReturnValue, nil, reportError("portAssignInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.portAssignInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiConvertLayer3Request struct { + ctx context.Context + ApiService *PortsApiService + id string + include *[]string + portConvertLayer3Input *PortConvertLayer3Input +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiConvertLayer3Request) Include(include []string) ApiConvertLayer3Request { + r.include = &include + return r +} + +// IPs to request +func (r ApiConvertLayer3Request) PortConvertLayer3Input(portConvertLayer3Input PortConvertLayer3Input) ApiConvertLayer3Request { + r.portConvertLayer3Input = &portConvertLayer3Input + return r +} + +func (r ApiConvertLayer3Request) Execute() (*Port, *http.Response, error) { + return r.ApiService.ConvertLayer3Execute(r) +} + +/* +ConvertLayer3 Convert to Layer 3 + +Converts a bond port to Layer 3. VLANs must first be unassigned. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiConvertLayer3Request +*/ +func (a *PortsApiService) ConvertLayer3(ctx context.Context, id string) ApiConvertLayer3Request { + return ApiConvertLayer3Request{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Port +func (a *PortsApiService) ConvertLayer3Execute(r ApiConvertLayer3Request) (*Port, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Port + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.ConvertLayer3") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/convert/layer-3" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.portConvertLayer3Input + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreatePortVlanAssignmentBatchRequest struct { + ctx context.Context + ApiService *PortsApiService + id string + portVlanAssignmentBatchCreateInput *PortVlanAssignmentBatchCreateInput + include *[]string +} + +// VLAN Assignment batch details +func (r ApiCreatePortVlanAssignmentBatchRequest) PortVlanAssignmentBatchCreateInput(portVlanAssignmentBatchCreateInput PortVlanAssignmentBatchCreateInput) ApiCreatePortVlanAssignmentBatchRequest { + r.portVlanAssignmentBatchCreateInput = &portVlanAssignmentBatchCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreatePortVlanAssignmentBatchRequest) Include(include []string) ApiCreatePortVlanAssignmentBatchRequest { + r.include = &include + return r +} + +func (r ApiCreatePortVlanAssignmentBatchRequest) Execute() (*PortVlanAssignmentBatch, *http.Response, error) { + return r.ApiService.CreatePortVlanAssignmentBatchExecute(r) +} + +/* +CreatePortVlanAssignmentBatch Create a new Port-VLAN Assignment management batch + +Create a new asynchronous batch request which handles adding and/or removing the VLANs to which the port is assigned. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiCreatePortVlanAssignmentBatchRequest +*/ +func (a *PortsApiService) CreatePortVlanAssignmentBatch(ctx context.Context, id string) ApiCreatePortVlanAssignmentBatchRequest { + return ApiCreatePortVlanAssignmentBatchRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return PortVlanAssignmentBatch +func (a *PortsApiService) CreatePortVlanAssignmentBatchExecute(r ApiCreatePortVlanAssignmentBatchRequest) (*PortVlanAssignmentBatch, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PortVlanAssignmentBatch + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.CreatePortVlanAssignmentBatch") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/vlan-assignments/batches" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.portVlanAssignmentBatchCreateInput == nil { + return localVarReturnValue, nil, reportError("portVlanAssignmentBatchCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.portVlanAssignmentBatchCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteNativeVlanRequest struct { + ctx context.Context + ApiService *PortsApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiDeleteNativeVlanRequest) Include(include []string) ApiDeleteNativeVlanRequest { + r.include = &include + return r +} + +func (r ApiDeleteNativeVlanRequest) Execute() (*Port, *http.Response, error) { + return r.ApiService.DeleteNativeVlanExecute(r) +} + +/* +DeleteNativeVlan Remove native VLAN + +Removes the native VLAN from this port + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiDeleteNativeVlanRequest +*/ +func (a *PortsApiService) DeleteNativeVlan(ctx context.Context, id string) ApiDeleteNativeVlanRequest { + return ApiDeleteNativeVlanRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Port +func (a *PortsApiService) DeleteNativeVlanExecute(r ApiDeleteNativeVlanRequest) (*Port, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Port + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.DeleteNativeVlan") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/native-vlan" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDisbondPortRequest struct { + ctx context.Context + ApiService *PortsApiService + id string + bulkDisable *bool + include *[]string +} + +// disable both ports +func (r ApiDisbondPortRequest) BulkDisable(bulkDisable bool) ApiDisbondPortRequest { + r.bulkDisable = &bulkDisable + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiDisbondPortRequest) Include(include []string) ApiDisbondPortRequest { + r.include = &include + return r +} + +func (r ApiDisbondPortRequest) Execute() (*Port, *http.Response, error) { + return r.ApiService.DisbondPortExecute(r) +} + +/* +DisbondPort Disabling bonding + +Disabling bonding for one or all ports + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiDisbondPortRequest +*/ +func (a *PortsApiService) DisbondPort(ctx context.Context, id string) ApiDisbondPortRequest { + return ApiDisbondPortRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Port +func (a *PortsApiService) DisbondPortExecute(r ApiDisbondPortRequest) (*Port, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Port + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.DisbondPort") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/disbond" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.bulkDisable != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "bulk_disable", r.bulkDisable, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindPortByIdRequest struct { + ctx context.Context + ApiService *PortsApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindPortByIdRequest) Include(include []string) ApiFindPortByIdRequest { + r.include = &include + return r +} + +func (r ApiFindPortByIdRequest) Execute() (*Port, *http.Response, error) { + return r.ApiService.FindPortByIdExecute(r) +} + +/* +FindPortById Retrieve a port + +Returns a port + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiFindPortByIdRequest +*/ +func (a *PortsApiService) FindPortById(ctx context.Context, id string) ApiFindPortByIdRequest { + return ApiFindPortByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Port +func (a *PortsApiService) FindPortByIdExecute(r ApiFindPortByIdRequest) (*Port, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Port + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.FindPortById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindPortVlanAssignmentBatchByPortIdAndBatchIdRequest struct { + ctx context.Context + ApiService *PortsApiService + id string + batchId string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindPortVlanAssignmentBatchByPortIdAndBatchIdRequest) Include(include []string) ApiFindPortVlanAssignmentBatchByPortIdAndBatchIdRequest { + r.include = &include + return r +} + +func (r ApiFindPortVlanAssignmentBatchByPortIdAndBatchIdRequest) Execute() (*PortVlanAssignmentBatch, *http.Response, error) { + return r.ApiService.FindPortVlanAssignmentBatchByPortIdAndBatchIdExecute(r) +} + +/* +FindPortVlanAssignmentBatchByPortIdAndBatchId Retrieve a VLAN Assignment Batch's details + +Returns the details of an existing Port-VLAN Assignment batch, including the list of VLANs to assign or unassign, and the current state of the batch. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @param batchId Batch ID + @return ApiFindPortVlanAssignmentBatchByPortIdAndBatchIdRequest +*/ +func (a *PortsApiService) FindPortVlanAssignmentBatchByPortIdAndBatchId(ctx context.Context, id string, batchId string) ApiFindPortVlanAssignmentBatchByPortIdAndBatchIdRequest { + return ApiFindPortVlanAssignmentBatchByPortIdAndBatchIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + batchId: batchId, + } +} + +// Execute executes the request +// +// @return PortVlanAssignmentBatch +func (a *PortsApiService) FindPortVlanAssignmentBatchByPortIdAndBatchIdExecute(r ApiFindPortVlanAssignmentBatchByPortIdAndBatchIdRequest) (*PortVlanAssignmentBatch, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PortVlanAssignmentBatch + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.FindPortVlanAssignmentBatchByPortIdAndBatchId") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/vlan-assignments/batches/{batch_id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"batch_id"+"}", url.PathEscape(parameterValueToString(r.batchId, "batchId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindPortVlanAssignmentBatchesRequest struct { + ctx context.Context + ApiService *PortsApiService + id string +} + +func (r ApiFindPortVlanAssignmentBatchesRequest) Execute() (*PortVlanAssignmentBatchList, *http.Response, error) { + return r.ApiService.FindPortVlanAssignmentBatchesExecute(r) +} + +/* +FindPortVlanAssignmentBatches List the VLAN Assignment Batches for a port + +Show all the VLAN assignment batches that have been created for managing this port's VLAN assignments + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiFindPortVlanAssignmentBatchesRequest +*/ +func (a *PortsApiService) FindPortVlanAssignmentBatches(ctx context.Context, id string) ApiFindPortVlanAssignmentBatchesRequest { + return ApiFindPortVlanAssignmentBatchesRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return PortVlanAssignmentBatchList +func (a *PortsApiService) FindPortVlanAssignmentBatchesExecute(r ApiFindPortVlanAssignmentBatchesRequest) (*PortVlanAssignmentBatchList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PortVlanAssignmentBatchList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.FindPortVlanAssignmentBatches") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/vlan-assignments/batches" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindPortVlanAssignmentByPortIdAndAssignmentIdRequest struct { + ctx context.Context + ApiService *PortsApiService + id string + assignmentId string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindPortVlanAssignmentByPortIdAndAssignmentIdRequest) Include(include []string) ApiFindPortVlanAssignmentByPortIdAndAssignmentIdRequest { + r.include = &include + return r +} + +func (r ApiFindPortVlanAssignmentByPortIdAndAssignmentIdRequest) Execute() (*PortVlanAssignment, *http.Response, error) { + return r.ApiService.FindPortVlanAssignmentByPortIdAndAssignmentIdExecute(r) +} + +/* +FindPortVlanAssignmentByPortIdAndAssignmentId Show a particular Port VLAN assignment's details + +Show the details of a specific Port-VLAN assignment, including the current state and if the VLAN is set as native. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @param assignmentId Assignment ID + @return ApiFindPortVlanAssignmentByPortIdAndAssignmentIdRequest +*/ +func (a *PortsApiService) FindPortVlanAssignmentByPortIdAndAssignmentId(ctx context.Context, id string, assignmentId string) ApiFindPortVlanAssignmentByPortIdAndAssignmentIdRequest { + return ApiFindPortVlanAssignmentByPortIdAndAssignmentIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + assignmentId: assignmentId, + } +} + +// Execute executes the request +// +// @return PortVlanAssignment +func (a *PortsApiService) FindPortVlanAssignmentByPortIdAndAssignmentIdExecute(r ApiFindPortVlanAssignmentByPortIdAndAssignmentIdRequest) (*PortVlanAssignment, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PortVlanAssignment + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.FindPortVlanAssignmentByPortIdAndAssignmentId") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/vlan-assignments/{assignment_id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"assignment_id"+"}", url.PathEscape(parameterValueToString(r.assignmentId, "assignmentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindPortVlanAssignmentsRequest struct { + ctx context.Context + ApiService *PortsApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindPortVlanAssignmentsRequest) Include(include []string) ApiFindPortVlanAssignmentsRequest { + r.include = &include + return r +} + +func (r ApiFindPortVlanAssignmentsRequest) Execute() (*PortVlanAssignmentList, *http.Response, error) { + return r.ApiService.FindPortVlanAssignmentsExecute(r) +} + +/* +FindPortVlanAssignments List Current VLAN assignments for a port + +Show the port's current VLAN assignments, including if this VLAN is set as native, and the current state of the assignment (ex. 'assigned' or 'unassigning') + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiFindPortVlanAssignmentsRequest +*/ +func (a *PortsApiService) FindPortVlanAssignments(ctx context.Context, id string) ApiFindPortVlanAssignmentsRequest { + return ApiFindPortVlanAssignmentsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return PortVlanAssignmentList +func (a *PortsApiService) FindPortVlanAssignmentsExecute(r ApiFindPortVlanAssignmentsRequest) (*PortVlanAssignmentList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PortVlanAssignmentList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.FindPortVlanAssignments") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/vlan-assignments" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUnassignPortRequest struct { + ctx context.Context + ApiService *PortsApiService + id string + portAssignInput *PortAssignInput + include *[]string +} + +// Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself (ex: '1001'). +func (r ApiUnassignPortRequest) PortAssignInput(portAssignInput PortAssignInput) ApiUnassignPortRequest { + r.portAssignInput = &portAssignInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUnassignPortRequest) Include(include []string) ApiUnassignPortRequest { + r.include = &include + return r +} + +func (r ApiUnassignPortRequest) Execute() (*Port, *http.Response, error) { + return r.ApiService.UnassignPortExecute(r) +} + +/* +UnassignPort Unassign a port + +Unassign a port for a hardware. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Port UUID + @return ApiUnassignPortRequest +*/ +func (a *PortsApiService) UnassignPort(ctx context.Context, id string) ApiUnassignPortRequest { + return ApiUnassignPortRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Port +func (a *PortsApiService) UnassignPortExecute(r ApiUnassignPortRequest) (*Port, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Port + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PortsApiService.UnassignPort") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ports/{id}/unassign" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.portAssignInput == nil { + return localVarReturnValue, nil, reportError("portAssignInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.portAssignInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_projects.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_projects.go new file mode 100644 index 00000000..2e2daece --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_projects.go @@ -0,0 +1,1911 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// ProjectsApiService ProjectsApi service +type ProjectsApiService service + +type ApiCreateProjectRequest struct { + ctx context.Context + ApiService *ProjectsApiService + projectCreateFromRootInput *ProjectCreateFromRootInput + include *[]string + exclude *[]string +} + +// Project to create +func (r ApiCreateProjectRequest) ProjectCreateFromRootInput(projectCreateFromRootInput ProjectCreateFromRootInput) ApiCreateProjectRequest { + r.projectCreateFromRootInput = &projectCreateFromRootInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateProjectRequest) Include(include []string) ApiCreateProjectRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateProjectRequest) Exclude(exclude []string) ApiCreateProjectRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateProjectRequest) Execute() (*Project, *http.Response, error) { + return r.ApiService.CreateProjectExecute(r) +} + +/* +CreateProject Create a project + +Creates a new project for the user default organization. If the user don't have an organization, a new one will be created. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateProjectRequest +*/ +func (a *ProjectsApiService) CreateProject(ctx context.Context) ApiCreateProjectRequest { + return ApiCreateProjectRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return Project +func (a *ProjectsApiService) CreateProjectExecute(r ApiCreateProjectRequest) (*Project, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Project + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.CreateProject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.projectCreateFromRootInput == nil { + return localVarReturnValue, nil, reportError("projectCreateFromRootInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.projectCreateFromRootInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateProjectInvitationRequest struct { + ctx context.Context + ApiService *ProjectsApiService + projectId string + invitationInput *InvitationInput + include *[]string +} + +// Invitation to create +func (r ApiCreateProjectInvitationRequest) InvitationInput(invitationInput InvitationInput) ApiCreateProjectInvitationRequest { + r.invitationInput = &invitationInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateProjectInvitationRequest) Include(include []string) ApiCreateProjectInvitationRequest { + r.include = &include + return r +} + +func (r ApiCreateProjectInvitationRequest) Execute() (*Invitation, *http.Response, error) { + return r.ApiService.CreateProjectInvitationExecute(r) +} + +/* +CreateProjectInvitation Create an invitation for a project + +In order to add a user to a project, they must first be invited. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project UUID + @return ApiCreateProjectInvitationRequest +*/ +func (a *ProjectsApiService) CreateProjectInvitation(ctx context.Context, projectId string) ApiCreateProjectInvitationRequest { + return ApiCreateProjectInvitationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return Invitation +func (a *ProjectsApiService) CreateProjectInvitationExecute(r ApiCreateProjectInvitationRequest) (*Invitation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Invitation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.CreateProjectInvitation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{project_id}/invitations" + localVarPath = strings.Replace(localVarPath, "{"+"project_id"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.invitationInput == nil { + return localVarReturnValue, nil, reportError("invitationInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.invitationInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateTransferRequestRequest struct { + ctx context.Context + ApiService *ProjectsApiService + id string + transferRequestInput *TransferRequestInput + include *[]string +} + +// Transfer Request to create +func (r ApiCreateTransferRequestRequest) TransferRequestInput(transferRequestInput TransferRequestInput) ApiCreateTransferRequestRequest { + r.transferRequestInput = &transferRequestInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateTransferRequestRequest) Include(include []string) ApiCreateTransferRequestRequest { + r.include = &include + return r +} + +func (r ApiCreateTransferRequestRequest) Execute() (*TransferRequest, *http.Response, error) { + return r.ApiService.CreateTransferRequestExecute(r) +} + +/* +CreateTransferRequest Create a transfer request + +Organization owners can transfer their projects to other organizations. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id UUID of the project to be transferred + @return ApiCreateTransferRequestRequest + +Deprecated +*/ +func (a *ProjectsApiService) CreateTransferRequest(ctx context.Context, id string) ApiCreateTransferRequestRequest { + return ApiCreateTransferRequestRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return TransferRequest +// +// Deprecated +func (a *ProjectsApiService) CreateTransferRequestExecute(r ApiCreateTransferRequestRequest) (*TransferRequest, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TransferRequest + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.CreateTransferRequest") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/transfers" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.transferRequestInput == nil { + return localVarReturnValue, nil, reportError("transferRequestInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.transferRequestInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteProjectRequest struct { + ctx context.Context + ApiService *ProjectsApiService + id string +} + +func (r ApiDeleteProjectRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteProjectExecute(r) +} + +/* +DeleteProject Delete the project + +Deletes the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiDeleteProjectRequest +*/ +func (a *ProjectsApiService) DeleteProject(ctx context.Context, id string) ApiDeleteProjectRequest { + return ApiDeleteProjectRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *ProjectsApiService) DeleteProjectExecute(r ApiDeleteProjectRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.DeleteProject") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindIPReservationCustomdataRequest struct { + ctx context.Context + ApiService *ProjectsApiService + projectId string + id string +} + +func (r ApiFindIPReservationCustomdataRequest) Execute() (*http.Response, error) { + return r.ApiService.FindIPReservationCustomdataExecute(r) +} + +/* +FindIPReservationCustomdata Retrieve the custom metadata of an IP Reservation + +Provides the custom metadata stored for this IP Reservation in json format + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project UUID + @param id Ip Reservation UUID + @return ApiFindIPReservationCustomdataRequest +*/ +func (a *ProjectsApiService) FindIPReservationCustomdata(ctx context.Context, projectId string, id string) ApiFindIPReservationCustomdataRequest { + return ApiFindIPReservationCustomdataRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + id: id, + } +} + +// Execute executes the request +func (a *ProjectsApiService) FindIPReservationCustomdataExecute(r ApiFindIPReservationCustomdataRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.FindIPReservationCustomdata") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{project_id}/ips/{id}/customdata" + localVarPath = strings.Replace(localVarPath, "{"+"project_id"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindProjectByIdRequest struct { + ctx context.Context + ApiService *ProjectsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindProjectByIdRequest) Include(include []string) ApiFindProjectByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindProjectByIdRequest) Exclude(exclude []string) ApiFindProjectByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindProjectByIdRequest) Execute() (*Project, *http.Response, error) { + return r.ApiService.FindProjectByIdExecute(r) +} + +/* +FindProjectById Retrieve a project + +Returns a single project if the user has access + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindProjectByIdRequest +*/ +func (a *ProjectsApiService) FindProjectById(ctx context.Context, id string) ApiFindProjectByIdRequest { + return ApiFindProjectByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Project +func (a *ProjectsApiService) FindProjectByIdExecute(r ApiFindProjectByIdRequest) (*Project, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Project + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.FindProjectById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindProjectCustomdataRequest struct { + ctx context.Context + ApiService *ProjectsApiService + id string +} + +func (r ApiFindProjectCustomdataRequest) Execute() (*http.Response, error) { + return r.ApiService.FindProjectCustomdataExecute(r) +} + +/* +FindProjectCustomdata Retrieve the custom metadata of a project + +Provides the custom metadata stored for this project in json format + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindProjectCustomdataRequest +*/ +func (a *ProjectsApiService) FindProjectCustomdata(ctx context.Context, id string) ApiFindProjectCustomdataRequest { + return ApiFindProjectCustomdataRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *ProjectsApiService) FindProjectCustomdataExecute(r ApiFindProjectCustomdataRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.FindProjectCustomdata") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/customdata" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindProjectInvitationsRequest struct { + ctx context.Context + ApiService *ProjectsApiService + projectId string + include *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindProjectInvitationsRequest) Include(include []string) ApiFindProjectInvitationsRequest { + r.include = &include + return r +} + +// Page to return +func (r ApiFindProjectInvitationsRequest) Page(page int32) ApiFindProjectInvitationsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindProjectInvitationsRequest) PerPage(perPage int32) ApiFindProjectInvitationsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindProjectInvitationsRequest) Execute() (*InvitationList, *http.Response, error) { + return r.ApiService.FindProjectInvitationsExecute(r) +} + +/* +FindProjectInvitations Retrieve project invitations + +Returns all invitations in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project UUID + @return ApiFindProjectInvitationsRequest +*/ +func (a *ProjectsApiService) FindProjectInvitations(ctx context.Context, projectId string) ApiFindProjectInvitationsRequest { + return ApiFindProjectInvitationsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return InvitationList +func (a *ProjectsApiService) FindProjectInvitationsExecute(r ApiFindProjectInvitationsRequest) (*InvitationList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InvitationList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.FindProjectInvitations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{project_id}/invitations" + localVarPath = strings.Replace(localVarPath, "{"+"project_id"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindProjectMembershipsRequest struct { + ctx context.Context + ApiService *ProjectsApiService + projectId string + search *string + include *[]string + page *int32 + perPage *int32 +} + +// Search by member full name, id and email. +func (r ApiFindProjectMembershipsRequest) Search(search string) ApiFindProjectMembershipsRequest { + r.search = &search + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindProjectMembershipsRequest) Include(include []string) ApiFindProjectMembershipsRequest { + r.include = &include + return r +} + +// Page to return +func (r ApiFindProjectMembershipsRequest) Page(page int32) ApiFindProjectMembershipsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindProjectMembershipsRequest) PerPage(perPage int32) ApiFindProjectMembershipsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindProjectMembershipsRequest) Execute() (*MembershipList, *http.Response, error) { + return r.ApiService.FindProjectMembershipsExecute(r) +} + +/* +FindProjectMemberships Retrieve project memberships + +Returns all memberships in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project UUID + @return ApiFindProjectMembershipsRequest +*/ +func (a *ProjectsApiService) FindProjectMemberships(ctx context.Context, projectId string) ApiFindProjectMembershipsRequest { + return ApiFindProjectMembershipsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return MembershipList +func (a *ProjectsApiService) FindProjectMembershipsExecute(r ApiFindProjectMembershipsRequest) (*MembershipList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MembershipList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.FindProjectMemberships") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{project_id}/memberships" + localVarPath = strings.Replace(localVarPath, "{"+"project_id"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.search != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindProjectsRequest struct { + ctx context.Context + ApiService *ProjectsApiService + name *string + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Filter results by name. +func (r ApiFindProjectsRequest) Name(name string) ApiFindProjectsRequest { + r.name = &name + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindProjectsRequest) Include(include []string) ApiFindProjectsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindProjectsRequest) Exclude(exclude []string) ApiFindProjectsRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindProjectsRequest) Page(page int32) ApiFindProjectsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindProjectsRequest) PerPage(perPage int32) ApiFindProjectsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindProjectsRequest) Execute() (*ProjectList, *http.Response, error) { + return r.ApiService.FindProjectsExecute(r) +} + +/* +FindProjects Retrieve all projects + +Returns a collection of projects that the current user is a member of. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindProjectsRequest +*/ +func (a *ProjectsApiService) FindProjects(ctx context.Context) ApiFindProjectsRequest { + return ApiFindProjectsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ProjectList +func (a *ProjectsApiService) FindProjectsExecute(r ApiFindProjectsRequest) (*ProjectList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ProjectList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.FindProjects") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.name != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return ProjectList +func (r ApiFindProjectsRequest) ExecuteWithPagination() (*ProjectList, error) { + + var items ProjectList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Projects = append(items.Projects, page.Projects...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiUpdateProjectRequest struct { + ctx context.Context + ApiService *ProjectsApiService + id string + projectUpdateInput *ProjectUpdateInput + include *[]string + exclude *[]string +} + +// Project to update +func (r ApiUpdateProjectRequest) ProjectUpdateInput(projectUpdateInput ProjectUpdateInput) ApiUpdateProjectRequest { + r.projectUpdateInput = &projectUpdateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateProjectRequest) Include(include []string) ApiUpdateProjectRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiUpdateProjectRequest) Exclude(exclude []string) ApiUpdateProjectRequest { + r.exclude = &exclude + return r +} + +func (r ApiUpdateProjectRequest) Execute() (*Project, *http.Response, error) { + return r.ApiService.UpdateProjectExecute(r) +} + +/* +UpdateProject Update the project + +Updates the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiUpdateProjectRequest +*/ +func (a *ProjectsApiService) UpdateProject(ctx context.Context, id string) ApiUpdateProjectRequest { + return ApiUpdateProjectRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Project +func (a *ProjectsApiService) UpdateProjectExecute(r ApiUpdateProjectRequest) (*Project, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Project + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.UpdateProject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.projectUpdateInput == nil { + return localVarReturnValue, nil, reportError("projectUpdateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.projectUpdateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_self_service_reservations.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_self_service_reservations.go new file mode 100644 index 00000000..8d556883 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_self_service_reservations.go @@ -0,0 +1,476 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// SelfServiceReservationsApiService SelfServiceReservationsApi service +type SelfServiceReservationsApiService service + +type ApiCreateSelfServiceReservationRequest struct { + ctx context.Context + ApiService *SelfServiceReservationsApiService + projectId string + createSelfServiceReservationRequest *CreateSelfServiceReservationRequest +} + +// reservation to create +func (r ApiCreateSelfServiceReservationRequest) CreateSelfServiceReservationRequest(createSelfServiceReservationRequest CreateSelfServiceReservationRequest) ApiCreateSelfServiceReservationRequest { + r.createSelfServiceReservationRequest = &createSelfServiceReservationRequest + return r +} + +func (r ApiCreateSelfServiceReservationRequest) Execute() (*SelfServiceReservationResponse, *http.Response, error) { + return r.ApiService.CreateSelfServiceReservationExecute(r) +} + +/* +CreateSelfServiceReservation Create a reservation + +Creates a reservation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project UUID + @return ApiCreateSelfServiceReservationRequest +*/ +func (a *SelfServiceReservationsApiService) CreateSelfServiceReservation(ctx context.Context, projectId string) ApiCreateSelfServiceReservationRequest { + return ApiCreateSelfServiceReservationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return SelfServiceReservationResponse +func (a *SelfServiceReservationsApiService) CreateSelfServiceReservationExecute(r ApiCreateSelfServiceReservationRequest) (*SelfServiceReservationResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SelfServiceReservationResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SelfServiceReservationsApiService.CreateSelfServiceReservation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{project_id}/self-service/reservations" + localVarPath = strings.Replace(localVarPath, "{"+"project_id"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createSelfServiceReservationRequest == nil { + return localVarReturnValue, nil, reportError("createSelfServiceReservationRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createSelfServiceReservationRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindSelfServiceReservationRequest struct { + ctx context.Context + ApiService *SelfServiceReservationsApiService + id string + projectId string +} + +func (r ApiFindSelfServiceReservationRequest) Execute() (*SelfServiceReservationResponse, *http.Response, error) { + return r.ApiService.FindSelfServiceReservationExecute(r) +} + +/* +FindSelfServiceReservation Retrieve a reservation + +Returns a reservation + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Reservation short_id + @param projectId Project UUID + @return ApiFindSelfServiceReservationRequest +*/ +func (a *SelfServiceReservationsApiService) FindSelfServiceReservation(ctx context.Context, id string, projectId string) ApiFindSelfServiceReservationRequest { + return ApiFindSelfServiceReservationRequest{ + ApiService: a, + ctx: ctx, + id: id, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return SelfServiceReservationResponse +func (a *SelfServiceReservationsApiService) FindSelfServiceReservationExecute(r ApiFindSelfServiceReservationRequest) (*SelfServiceReservationResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SelfServiceReservationResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SelfServiceReservationsApiService.FindSelfServiceReservation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{project_id}/self-service/reservations/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project_id"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindSelfServiceReservationsRequest struct { + ctx context.Context + ApiService *SelfServiceReservationsApiService + projectId string + page *int32 + perPage *int32 + categories *[]FindOrganizationDevicesCategoriesParameterInner +} + +// Page to return +func (r ApiFindSelfServiceReservationsRequest) Page(page int32) ApiFindSelfServiceReservationsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindSelfServiceReservationsRequest) PerPage(perPage int32) ApiFindSelfServiceReservationsRequest { + r.perPage = &perPage + return r +} + +// Filter reservations by items category +func (r ApiFindSelfServiceReservationsRequest) Categories(categories []FindOrganizationDevicesCategoriesParameterInner) ApiFindSelfServiceReservationsRequest { + r.categories = &categories + return r +} + +func (r ApiFindSelfServiceReservationsRequest) Execute() (*SelfServiceReservationList, *http.Response, error) { + return r.ApiService.FindSelfServiceReservationsExecute(r) +} + +/* +FindSelfServiceReservations Retrieve all reservations + +Returns all reservations. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project UUID + @return ApiFindSelfServiceReservationsRequest +*/ +func (a *SelfServiceReservationsApiService) FindSelfServiceReservations(ctx context.Context, projectId string) ApiFindSelfServiceReservationsRequest { + return ApiFindSelfServiceReservationsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return SelfServiceReservationList +func (a *SelfServiceReservationsApiService) FindSelfServiceReservationsExecute(r ApiFindSelfServiceReservationsRequest) (*SelfServiceReservationList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SelfServiceReservationList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SelfServiceReservationsApiService.FindSelfServiceReservations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{project_id}/self-service/reservations" + localVarPath = strings.Replace(localVarPath, "{"+"project_id"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + if r.categories != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "categories", r.categories, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_spot_market.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_spot_market.go new file mode 100644 index 00000000..85e54c4f --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_spot_market.go @@ -0,0 +1,1142 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// SpotMarketApiService SpotMarketApi service +type SpotMarketApiService service + +type ApiCreateSpotMarketRequestRequest struct { + ctx context.Context + ApiService *SpotMarketApiService + id string + spotMarketRequestCreateInput *SpotMarketRequestCreateInput +} + +// Spot Market Request to create +func (r ApiCreateSpotMarketRequestRequest) SpotMarketRequestCreateInput(spotMarketRequestCreateInput SpotMarketRequestCreateInput) ApiCreateSpotMarketRequestRequest { + r.spotMarketRequestCreateInput = &spotMarketRequestCreateInput + return r +} + +func (r ApiCreateSpotMarketRequestRequest) Execute() (*SpotMarketRequest, *http.Response, error) { + return r.ApiService.CreateSpotMarketRequestExecute(r) +} + +/* +CreateSpotMarketRequest Create a spot market request + +Creates a new spot market request. + +Type-specific options (such as operating_system for baremetal devices) should be included in the main data structure alongside hostname and plan. + +The features attribute allows you to optionally specify what features your server should have. For example, if you require a server with a TPM chip, you may specify `{ "features": { "tpm": "required" } }` (or `{ "features": ["tpm"] }` in shorthand). + +The request will fail if there are no available servers matching your criteria. Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a preferred value (see the example request below). + +The request will not fail if we have no servers with that feature in our inventory. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiCreateSpotMarketRequestRequest +*/ +func (a *SpotMarketApiService) CreateSpotMarketRequest(ctx context.Context, id string) ApiCreateSpotMarketRequestRequest { + return ApiCreateSpotMarketRequestRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return SpotMarketRequest +func (a *SpotMarketApiService) CreateSpotMarketRequestExecute(r ApiCreateSpotMarketRequestRequest) (*SpotMarketRequest, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SpotMarketRequest + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SpotMarketApiService.CreateSpotMarketRequest") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/spot-market-requests" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.spotMarketRequestCreateInput == nil { + return localVarReturnValue, nil, reportError("spotMarketRequestCreateInput is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.spotMarketRequestCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteSpotMarketRequestRequest struct { + ctx context.Context + ApiService *SpotMarketApiService + id string + forceTermination *bool +} + +// Terminate associated spot instances +func (r ApiDeleteSpotMarketRequestRequest) ForceTermination(forceTermination bool) ApiDeleteSpotMarketRequestRequest { + r.forceTermination = &forceTermination + return r +} + +func (r ApiDeleteSpotMarketRequestRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteSpotMarketRequestExecute(r) +} + +/* +DeleteSpotMarketRequest Delete the spot market request + +Deletes the spot market request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id SpotMarketRequest UUID + @return ApiDeleteSpotMarketRequestRequest +*/ +func (a *SpotMarketApiService) DeleteSpotMarketRequest(ctx context.Context, id string) ApiDeleteSpotMarketRequestRequest { + return ApiDeleteSpotMarketRequestRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *SpotMarketApiService) DeleteSpotMarketRequestExecute(r ApiDeleteSpotMarketRequestRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SpotMarketApiService.DeleteSpotMarketRequest") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/spot-market-requests/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.forceTermination != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "force_termination", r.forceTermination, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindMetroSpotMarketPricesRequest struct { + ctx context.Context + ApiService *SpotMarketApiService + metro *string + plan *string +} + +// Metro to filter spot market prices +func (r ApiFindMetroSpotMarketPricesRequest) Metro(metro string) ApiFindMetroSpotMarketPricesRequest { + r.metro = &metro + return r +} + +// Plan to filter spot market prices +func (r ApiFindMetroSpotMarketPricesRequest) Plan(plan string) ApiFindMetroSpotMarketPricesRequest { + r.plan = &plan + return r +} + +func (r ApiFindMetroSpotMarketPricesRequest) Execute() (*SpotMarketPricesPerMetroList, *http.Response, error) { + return r.ApiService.FindMetroSpotMarketPricesExecute(r) +} + +/* +FindMetroSpotMarketPrices Get current spot market prices for metros + +Get Equinix Metal current spot market prices for all metros. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindMetroSpotMarketPricesRequest +*/ +func (a *SpotMarketApiService) FindMetroSpotMarketPrices(ctx context.Context) ApiFindMetroSpotMarketPricesRequest { + return ApiFindMetroSpotMarketPricesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return SpotMarketPricesPerMetroList +func (a *SpotMarketApiService) FindMetroSpotMarketPricesExecute(r ApiFindMetroSpotMarketPricesRequest) (*SpotMarketPricesPerMetroList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SpotMarketPricesPerMetroList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SpotMarketApiService.FindMetroSpotMarketPrices") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/market/spot/prices/metros" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.metro != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "metro", r.metro, "") + } + if r.plan != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "plan", r.plan, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindSpotMarketPricesRequest struct { + ctx context.Context + ApiService *SpotMarketApiService + facility *string + plan *string +} + +// Facility to check spot market prices +func (r ApiFindSpotMarketPricesRequest) Facility(facility string) ApiFindSpotMarketPricesRequest { + r.facility = &facility + return r +} + +// Plan to check spot market prices +func (r ApiFindSpotMarketPricesRequest) Plan(plan string) ApiFindSpotMarketPricesRequest { + r.plan = &plan + return r +} + +func (r ApiFindSpotMarketPricesRequest) Execute() (*SpotMarketPricesList, *http.Response, error) { + return r.ApiService.FindSpotMarketPricesExecute(r) +} + +/* +FindSpotMarketPrices Get current spot market prices + +Get Equinix Metal current spot market prices. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindSpotMarketPricesRequest +*/ +func (a *SpotMarketApiService) FindSpotMarketPrices(ctx context.Context) ApiFindSpotMarketPricesRequest { + return ApiFindSpotMarketPricesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return SpotMarketPricesList +func (a *SpotMarketApiService) FindSpotMarketPricesExecute(r ApiFindSpotMarketPricesRequest) (*SpotMarketPricesList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SpotMarketPricesList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SpotMarketApiService.FindSpotMarketPrices") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/market/spot/prices" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.facility != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "facility", r.facility, "") + } + if r.plan != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "plan", r.plan, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindSpotMarketPricesHistoryRequest struct { + ctx context.Context + ApiService *SpotMarketApiService + facility *string + plan *string + from *string + until *string + metro *string +} + +// Facility to check spot market prices +func (r ApiFindSpotMarketPricesHistoryRequest) Facility(facility string) ApiFindSpotMarketPricesHistoryRequest { + r.facility = &facility + return r +} + +// Plan to check spot market prices +func (r ApiFindSpotMarketPricesHistoryRequest) Plan(plan string) ApiFindSpotMarketPricesHistoryRequest { + r.plan = &plan + return r +} + +// Timestamp from range +func (r ApiFindSpotMarketPricesHistoryRequest) From(from string) ApiFindSpotMarketPricesHistoryRequest { + r.from = &from + return r +} + +// Timestamp to range +func (r ApiFindSpotMarketPricesHistoryRequest) Until(until string) ApiFindSpotMarketPricesHistoryRequest { + r.until = &until + return r +} + +// Metro to check spot market price history +func (r ApiFindSpotMarketPricesHistoryRequest) Metro(metro string) ApiFindSpotMarketPricesHistoryRequest { + r.metro = &metro + return r +} + +func (r ApiFindSpotMarketPricesHistoryRequest) Execute() (*SpotPricesHistoryReport, *http.Response, error) { + return r.ApiService.FindSpotMarketPricesHistoryExecute(r) +} + +/* +FindSpotMarketPricesHistory Get spot market prices for a given period of time + +# Get spot market prices for a given plan and facility in a fixed period of time + +*Note: In the `200` response, the property `datapoints` contains arrays of `[float, integer]`.* + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindSpotMarketPricesHistoryRequest +*/ +func (a *SpotMarketApiService) FindSpotMarketPricesHistory(ctx context.Context) ApiFindSpotMarketPricesHistoryRequest { + return ApiFindSpotMarketPricesHistoryRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return SpotPricesHistoryReport +func (a *SpotMarketApiService) FindSpotMarketPricesHistoryExecute(r ApiFindSpotMarketPricesHistoryRequest) (*SpotPricesHistoryReport, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SpotPricesHistoryReport + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SpotMarketApiService.FindSpotMarketPricesHistory") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/market/spot/prices/history" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.facility == nil { + return localVarReturnValue, nil, reportError("facility is required and must be specified") + } + if r.plan == nil { + return localVarReturnValue, nil, reportError("plan is required and must be specified") + } + if r.from == nil { + return localVarReturnValue, nil, reportError("from is required and must be specified") + } + if r.until == nil { + return localVarReturnValue, nil, reportError("until is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "facility", r.facility, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "plan", r.plan, "") + if r.metro != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "metro", r.metro, "") + } + parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "until", r.until, "") + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindSpotMarketRequestByIdRequest struct { + ctx context.Context + ApiService *SpotMarketApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindSpotMarketRequestByIdRequest) Include(include []string) ApiFindSpotMarketRequestByIdRequest { + r.include = &include + return r +} + +func (r ApiFindSpotMarketRequestByIdRequest) Execute() (*SpotMarketRequest, *http.Response, error) { + return r.ApiService.FindSpotMarketRequestByIdExecute(r) +} + +/* +FindSpotMarketRequestById Retrieve a spot market request + +Returns a single spot market request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id SpotMarketRequest UUID + @return ApiFindSpotMarketRequestByIdRequest +*/ +func (a *SpotMarketApiService) FindSpotMarketRequestById(ctx context.Context, id string) ApiFindSpotMarketRequestByIdRequest { + return ApiFindSpotMarketRequestByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return SpotMarketRequest +func (a *SpotMarketApiService) FindSpotMarketRequestByIdExecute(r ApiFindSpotMarketRequestByIdRequest) (*SpotMarketRequest, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SpotMarketRequest + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SpotMarketApiService.FindSpotMarketRequestById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/spot-market-requests/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListSpotMarketRequestsRequest struct { + ctx context.Context + ApiService *SpotMarketApiService + id string +} + +func (r ApiListSpotMarketRequestsRequest) Execute() (*SpotMarketRequestList, *http.Response, error) { + return r.ApiService.ListSpotMarketRequestsExecute(r) +} + +/* +ListSpotMarketRequests List spot market requests + +View all spot market requests for a given project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiListSpotMarketRequestsRequest +*/ +func (a *SpotMarketApiService) ListSpotMarketRequests(ctx context.Context, id string) ApiListSpotMarketRequestsRequest { + return ApiListSpotMarketRequestsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return SpotMarketRequestList +func (a *SpotMarketApiService) ListSpotMarketRequestsExecute(r ApiListSpotMarketRequestsRequest) (*SpotMarketRequestList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SpotMarketRequestList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SpotMarketApiService.ListSpotMarketRequests") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/spot-market-requests" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ssh_keys.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ssh_keys.go new file mode 100644 index 00000000..8be652d6 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_ssh_keys.go @@ -0,0 +1,1263 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// SSHKeysApiService SSHKeysApi service +type SSHKeysApiService service + +type ApiCreateProjectSSHKeyRequest struct { + ctx context.Context + ApiService *SSHKeysApiService + id string + sSHKeyCreateInput *SSHKeyCreateInput + include *[]string +} + +// ssh key to create +func (r ApiCreateProjectSSHKeyRequest) SSHKeyCreateInput(sSHKeyCreateInput SSHKeyCreateInput) ApiCreateProjectSSHKeyRequest { + r.sSHKeyCreateInput = &sSHKeyCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateProjectSSHKeyRequest) Include(include []string) ApiCreateProjectSSHKeyRequest { + r.include = &include + return r +} + +func (r ApiCreateProjectSSHKeyRequest) Execute() (*SSHKey, *http.Response, error) { + return r.ApiService.CreateProjectSSHKeyExecute(r) +} + +/* +CreateProjectSSHKey Create a ssh key for the given project + +Creates a ssh key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiCreateProjectSSHKeyRequest +*/ +func (a *SSHKeysApiService) CreateProjectSSHKey(ctx context.Context, id string) ApiCreateProjectSSHKeyRequest { + return ApiCreateProjectSSHKeyRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return SSHKey +func (a *SSHKeysApiService) CreateProjectSSHKeyExecute(r ApiCreateProjectSSHKeyRequest) (*SSHKey, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SSHKey + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SSHKeysApiService.CreateProjectSSHKey") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/ssh-keys" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.sSHKeyCreateInput == nil { + return localVarReturnValue, nil, reportError("sSHKeyCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.sSHKeyCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateSSHKeyRequest struct { + ctx context.Context + ApiService *SSHKeysApiService + sSHKeyCreateInput *SSHKeyCreateInput + include *[]string +} + +// ssh key to create +func (r ApiCreateSSHKeyRequest) SSHKeyCreateInput(sSHKeyCreateInput SSHKeyCreateInput) ApiCreateSSHKeyRequest { + r.sSHKeyCreateInput = &sSHKeyCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateSSHKeyRequest) Include(include []string) ApiCreateSSHKeyRequest { + r.include = &include + return r +} + +func (r ApiCreateSSHKeyRequest) Execute() (*SSHKey, *http.Response, error) { + return r.ApiService.CreateSSHKeyExecute(r) +} + +/* +CreateSSHKey Create a ssh key for the current user + +Creates a ssh key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateSSHKeyRequest +*/ +func (a *SSHKeysApiService) CreateSSHKey(ctx context.Context) ApiCreateSSHKeyRequest { + return ApiCreateSSHKeyRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return SSHKey +func (a *SSHKeysApiService) CreateSSHKeyExecute(r ApiCreateSSHKeyRequest) (*SSHKey, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SSHKey + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SSHKeysApiService.CreateSSHKey") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ssh-keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.sSHKeyCreateInput == nil { + return localVarReturnValue, nil, reportError("sSHKeyCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.sSHKeyCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteSSHKeyRequest struct { + ctx context.Context + ApiService *SSHKeysApiService + id string +} + +func (r ApiDeleteSSHKeyRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteSSHKeyExecute(r) +} + +/* +DeleteSSHKey Delete the ssh key + +Deletes the ssh key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id ssh key UUID + @return ApiDeleteSSHKeyRequest +*/ +func (a *SSHKeysApiService) DeleteSSHKey(ctx context.Context, id string) ApiDeleteSSHKeyRequest { + return ApiDeleteSSHKeyRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *SSHKeysApiService) DeleteSSHKeyExecute(r ApiDeleteSSHKeyRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SSHKeysApiService.DeleteSSHKey") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ssh-keys/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindDeviceSSHKeysRequest struct { + ctx context.Context + ApiService *SSHKeysApiService + id string + searchString *string + include *[]string +} + +// Search by key, label, or fingerprint +func (r ApiFindDeviceSSHKeysRequest) SearchString(searchString string) ApiFindDeviceSSHKeysRequest { + r.searchString = &searchString + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindDeviceSSHKeysRequest) Include(include []string) ApiFindDeviceSSHKeysRequest { + r.include = &include + return r +} + +func (r ApiFindDeviceSSHKeysRequest) Execute() (*SSHKeyList, *http.Response, error) { + return r.ApiService.FindDeviceSSHKeysExecute(r) +} + +/* +FindDeviceSSHKeys Retrieve a device's ssh keys + +Returns a collection of the device's ssh keys. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindDeviceSSHKeysRequest +*/ +func (a *SSHKeysApiService) FindDeviceSSHKeys(ctx context.Context, id string) ApiFindDeviceSSHKeysRequest { + return ApiFindDeviceSSHKeysRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return SSHKeyList +func (a *SSHKeysApiService) FindDeviceSSHKeysExecute(r ApiFindDeviceSSHKeysRequest) (*SSHKeyList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SSHKeyList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SSHKeysApiService.FindDeviceSSHKeys") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/ssh-keys" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.searchString != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "Search string", r.searchString, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindProjectSSHKeysRequest struct { + ctx context.Context + ApiService *SSHKeysApiService + id string + query *string + include *[]string +} + +// Search by key, label, or fingerprint +func (r ApiFindProjectSSHKeysRequest) Query(query string) ApiFindProjectSSHKeysRequest { + r.query = &query + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindProjectSSHKeysRequest) Include(include []string) ApiFindProjectSSHKeysRequest { + r.include = &include + return r +} + +func (r ApiFindProjectSSHKeysRequest) Execute() (*SSHKeyList, *http.Response, error) { + return r.ApiService.FindProjectSSHKeysExecute(r) +} + +/* +FindProjectSSHKeys Retrieve a project's ssh keys + +Returns a collection of the project's ssh keys. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindProjectSSHKeysRequest +*/ +func (a *SSHKeysApiService) FindProjectSSHKeys(ctx context.Context, id string) ApiFindProjectSSHKeysRequest { + return ApiFindProjectSSHKeysRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return SSHKeyList +func (a *SSHKeysApiService) FindProjectSSHKeysExecute(r ApiFindProjectSSHKeysRequest) (*SSHKeyList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SSHKeyList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SSHKeysApiService.FindProjectSSHKeys") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/ssh-keys" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.query != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "query", r.query, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindSSHKeyByIdRequest struct { + ctx context.Context + ApiService *SSHKeysApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindSSHKeyByIdRequest) Include(include []string) ApiFindSSHKeyByIdRequest { + r.include = &include + return r +} + +func (r ApiFindSSHKeyByIdRequest) Execute() (*SSHKey, *http.Response, error) { + return r.ApiService.FindSSHKeyByIdExecute(r) +} + +/* +FindSSHKeyById Retrieve a ssh key + +Returns a single ssh key if the user has access + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id SSH Key UUID + @return ApiFindSSHKeyByIdRequest +*/ +func (a *SSHKeysApiService) FindSSHKeyById(ctx context.Context, id string) ApiFindSSHKeyByIdRequest { + return ApiFindSSHKeyByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return SSHKey +func (a *SSHKeysApiService) FindSSHKeyByIdExecute(r ApiFindSSHKeyByIdRequest) (*SSHKey, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SSHKey + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SSHKeysApiService.FindSSHKeyById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ssh-keys/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindSSHKeysRequest struct { + ctx context.Context + ApiService *SSHKeysApiService + search *string + include *[]string +} + +// Search by key, label, or fingerprint +func (r ApiFindSSHKeysRequest) Search(search string) ApiFindSSHKeysRequest { + r.search = &search + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindSSHKeysRequest) Include(include []string) ApiFindSSHKeysRequest { + r.include = &include + return r +} + +func (r ApiFindSSHKeysRequest) Execute() (*SSHKeyList, *http.Response, error) { + return r.ApiService.FindSSHKeysExecute(r) +} + +/* +FindSSHKeys Retrieve all ssh keys + +Returns a collection of the user’s ssh keys. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindSSHKeysRequest +*/ +func (a *SSHKeysApiService) FindSSHKeys(ctx context.Context) ApiFindSSHKeysRequest { + return ApiFindSSHKeysRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return SSHKeyList +func (a *SSHKeysApiService) FindSSHKeysExecute(r ApiFindSSHKeysRequest) (*SSHKeyList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SSHKeyList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SSHKeysApiService.FindSSHKeys") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ssh-keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.search != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "") + } + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateSSHKeyRequest struct { + ctx context.Context + ApiService *SSHKeysApiService + id string + sSHKeyInput *SSHKeyInput + include *[]string +} + +// ssh key to update +func (r ApiUpdateSSHKeyRequest) SSHKeyInput(sSHKeyInput SSHKeyInput) ApiUpdateSSHKeyRequest { + r.sSHKeyInput = &sSHKeyInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateSSHKeyRequest) Include(include []string) ApiUpdateSSHKeyRequest { + r.include = &include + return r +} + +func (r ApiUpdateSSHKeyRequest) Execute() (*SSHKey, *http.Response, error) { + return r.ApiService.UpdateSSHKeyExecute(r) +} + +/* +UpdateSSHKey Update the ssh key + +Updates the ssh key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id SSH Key UUID + @return ApiUpdateSSHKeyRequest +*/ +func (a *SSHKeysApiService) UpdateSSHKey(ctx context.Context, id string) ApiUpdateSSHKeyRequest { + return ApiUpdateSSHKeyRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return SSHKey +func (a *SSHKeysApiService) UpdateSSHKeyExecute(r ApiUpdateSSHKeyRequest) (*SSHKey, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SSHKey + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SSHKeysApiService.UpdateSSHKey") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ssh-keys/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.sSHKeyInput == nil { + return localVarReturnValue, nil, reportError("sSHKeyInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.sSHKeyInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_support_request.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_support_request.go new file mode 100644 index 00000000..4e5f4a34 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_support_request.go @@ -0,0 +1,180 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +// SupportRequestApiService SupportRequestApi service +type SupportRequestApiService service + +type ApiRequestSuppertRequest struct { + ctx context.Context + ApiService *SupportRequestApiService + supportRequestInput *SupportRequestInput +} + +// Support Request to create +func (r ApiRequestSuppertRequest) SupportRequestInput(supportRequestInput SupportRequestInput) ApiRequestSuppertRequest { + r.supportRequestInput = &supportRequestInput + return r +} + +func (r ApiRequestSuppertRequest) Execute() (*http.Response, error) { + return r.ApiService.RequestSuppertExecute(r) +} + +/* +RequestSuppert Create a support ticket + +Support Ticket. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiRequestSuppertRequest +*/ +func (a *SupportRequestApiService) RequestSuppert(ctx context.Context) ApiRequestSuppertRequest { + return ApiRequestSuppertRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *SupportRequestApiService) RequestSuppertExecute(r ApiRequestSuppertRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SupportRequestApiService.RequestSuppert") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/support-requests" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.supportRequestInput == nil { + return nil, reportError("supportRequestInput is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.supportRequestInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_transfer_requests.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_transfer_requests.go new file mode 100644 index 00000000..f933bb4f --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_transfer_requests.go @@ -0,0 +1,460 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// TransferRequestsApiService TransferRequestsApi service +type TransferRequestsApiService service + +type ApiAcceptTransferRequestRequest struct { + ctx context.Context + ApiService *TransferRequestsApiService + id string +} + +func (r ApiAcceptTransferRequestRequest) Execute() (*http.Response, error) { + return r.ApiService.AcceptTransferRequestExecute(r) +} + +/* +AcceptTransferRequest Accept a transfer request + +Accept a transfer request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Transfer request UUID + @return ApiAcceptTransferRequestRequest +*/ +func (a *TransferRequestsApiService) AcceptTransferRequest(ctx context.Context, id string) ApiAcceptTransferRequestRequest { + return ApiAcceptTransferRequestRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *TransferRequestsApiService) AcceptTransferRequestExecute(r ApiAcceptTransferRequestRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TransferRequestsApiService.AcceptTransferRequest") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/transfers/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeclineTransferRequestRequest struct { + ctx context.Context + ApiService *TransferRequestsApiService + id string +} + +func (r ApiDeclineTransferRequestRequest) Execute() (*http.Response, error) { + return r.ApiService.DeclineTransferRequestExecute(r) +} + +/* +DeclineTransferRequest Decline a transfer request + +Decline a transfer request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Transfer request UUID + @return ApiDeclineTransferRequestRequest +*/ +func (a *TransferRequestsApiService) DeclineTransferRequest(ctx context.Context, id string) ApiDeclineTransferRequestRequest { + return ApiDeclineTransferRequestRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *TransferRequestsApiService) DeclineTransferRequestExecute(r ApiDeclineTransferRequestRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TransferRequestsApiService.DeclineTransferRequest") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/transfers/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindTransferRequestByIdRequest struct { + ctx context.Context + ApiService *TransferRequestsApiService + id string + include *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindTransferRequestByIdRequest) Include(include []string) ApiFindTransferRequestByIdRequest { + r.include = &include + return r +} + +func (r ApiFindTransferRequestByIdRequest) Execute() (*TransferRequest, *http.Response, error) { + return r.ApiService.FindTransferRequestByIdExecute(r) +} + +/* +FindTransferRequestById View a transfer request + +Returns a single transfer request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Transfer request UUID + @return ApiFindTransferRequestByIdRequest +*/ +func (a *TransferRequestsApiService) FindTransferRequestById(ctx context.Context, id string) ApiFindTransferRequestByIdRequest { + return ApiFindTransferRequestByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return TransferRequest +func (a *TransferRequestsApiService) FindTransferRequestByIdExecute(r ApiFindTransferRequestByIdRequest) (*TransferRequest, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TransferRequest + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TransferRequestsApiService.FindTransferRequestById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/transfers/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_two_factor_auth.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_two_factor_auth.go new file mode 100644 index 00000000..e728c58f --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_two_factor_auth.go @@ -0,0 +1,533 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +// TwoFactorAuthApiService TwoFactorAuthApi service +type TwoFactorAuthApiService service + +type ApiDisableTfaAppRequest struct { + ctx context.Context + ApiService *TwoFactorAuthApiService + xOtpToken *string +} + +func (r ApiDisableTfaAppRequest) XOtpToken(xOtpToken string) ApiDisableTfaAppRequest { + r.xOtpToken = &xOtpToken + return r +} + +func (r ApiDisableTfaAppRequest) Execute() (*http.Response, error) { + return r.ApiService.DisableTfaAppExecute(r) +} + +/* +DisableTfaApp Disable two factor authentication + +Disables two factor authentication. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiDisableTfaAppRequest +*/ +func (a *TwoFactorAuthApiService) DisableTfaApp(ctx context.Context) ApiDisableTfaAppRequest { + return ApiDisableTfaAppRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *TwoFactorAuthApiService) DisableTfaAppExecute(r ApiDisableTfaAppRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TwoFactorAuthApiService.DisableTfaApp") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/otp/app" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xOtpToken == nil { + return nil, reportError("xOtpToken is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "x-otp-token", r.xOtpToken, "") + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDisableTfaSmsRequest struct { + ctx context.Context + ApiService *TwoFactorAuthApiService + xOtpToken *string +} + +func (r ApiDisableTfaSmsRequest) XOtpToken(xOtpToken string) ApiDisableTfaSmsRequest { + r.xOtpToken = &xOtpToken + return r +} + +func (r ApiDisableTfaSmsRequest) Execute() (*http.Response, error) { + return r.ApiService.DisableTfaSmsExecute(r) +} + +/* +DisableTfaSms Disable two factor authentication + +Disables two factor authentication. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiDisableTfaSmsRequest +*/ +func (a *TwoFactorAuthApiService) DisableTfaSms(ctx context.Context) ApiDisableTfaSmsRequest { + return ApiDisableTfaSmsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *TwoFactorAuthApiService) DisableTfaSmsExecute(r ApiDisableTfaSmsRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TwoFactorAuthApiService.DisableTfaSms") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/otp/sms" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xOtpToken == nil { + return nil, reportError("xOtpToken is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "x-otp-token", r.xOtpToken, "") + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiEnableTfaAppRequest struct { + ctx context.Context + ApiService *TwoFactorAuthApiService + xOtpToken *string +} + +func (r ApiEnableTfaAppRequest) XOtpToken(xOtpToken string) ApiEnableTfaAppRequest { + r.xOtpToken = &xOtpToken + return r +} + +func (r ApiEnableTfaAppRequest) Execute() (*http.Response, error) { + return r.ApiService.EnableTfaAppExecute(r) +} + +/* +EnableTfaApp Enable two factor auth using app + +Enables two factor authentication using authenticator app. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiEnableTfaAppRequest +*/ +func (a *TwoFactorAuthApiService) EnableTfaApp(ctx context.Context) ApiEnableTfaAppRequest { + return ApiEnableTfaAppRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *TwoFactorAuthApiService) EnableTfaAppExecute(r ApiEnableTfaAppRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TwoFactorAuthApiService.EnableTfaApp") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/otp/app" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xOtpToken == nil { + return nil, reportError("xOtpToken is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "x-otp-token", r.xOtpToken, "") + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiEnableTfaSmsRequest struct { + ctx context.Context + ApiService *TwoFactorAuthApiService + xOtpToken *string +} + +func (r ApiEnableTfaSmsRequest) XOtpToken(xOtpToken string) ApiEnableTfaSmsRequest { + r.xOtpToken = &xOtpToken + return r +} + +func (r ApiEnableTfaSmsRequest) Execute() (*http.Response, error) { + return r.ApiService.EnableTfaSmsExecute(r) +} + +/* +EnableTfaSms Enable two factor auth using sms + +Enables two factor authentication with sms. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiEnableTfaSmsRequest +*/ +func (a *TwoFactorAuthApiService) EnableTfaSms(ctx context.Context) ApiEnableTfaSmsRequest { + return ApiEnableTfaSmsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *TwoFactorAuthApiService) EnableTfaSmsExecute(r ApiEnableTfaSmsRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TwoFactorAuthApiService.EnableTfaSms") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user/otp/sms" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.xOtpToken == nil { + return nil, reportError("xOtpToken is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "x-otp-token", r.xOtpToken, "") + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_usages.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_usages.go new file mode 100644 index 00000000..ff4aae8b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_usages.go @@ -0,0 +1,342 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// UsagesApiService UsagesApi service +type UsagesApiService service + +type ApiFindDeviceUsagesRequest struct { + ctx context.Context + ApiService *UsagesApiService + id string + createdAfter *string + createdBefore *string +} + +// Filter usages created after this date +func (r ApiFindDeviceUsagesRequest) CreatedAfter(createdAfter string) ApiFindDeviceUsagesRequest { + r.createdAfter = &createdAfter + return r +} + +// Filter usages created before this date +func (r ApiFindDeviceUsagesRequest) CreatedBefore(createdBefore string) ApiFindDeviceUsagesRequest { + r.createdBefore = &createdBefore + return r +} + +func (r ApiFindDeviceUsagesRequest) Execute() (*DeviceUsageList, *http.Response, error) { + return r.ApiService.FindDeviceUsagesExecute(r) +} + +/* +FindDeviceUsages Retrieve all usages for device + +Returns all usages for a device. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Device UUID + @return ApiFindDeviceUsagesRequest +*/ +func (a *UsagesApiService) FindDeviceUsages(ctx context.Context, id string) ApiFindDeviceUsagesRequest { + return ApiFindDeviceUsagesRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return DeviceUsageList +func (a *UsagesApiService) FindDeviceUsagesExecute(r ApiFindDeviceUsagesRequest) (*DeviceUsageList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeviceUsageList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsagesApiService.FindDeviceUsages") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/devices/{id}/usages" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.createdAfter != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "created[after]", r.createdAfter, "") + } + if r.createdBefore != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "created[before]", r.createdBefore, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindProjectUsageRequest struct { + ctx context.Context + ApiService *UsagesApiService + id string + createdAfter *string + createdBefore *string +} + +// Filter usages created after this date +func (r ApiFindProjectUsageRequest) CreatedAfter(createdAfter string) ApiFindProjectUsageRequest { + r.createdAfter = &createdAfter + return r +} + +// Filter usages created before this date +func (r ApiFindProjectUsageRequest) CreatedBefore(createdBefore string) ApiFindProjectUsageRequest { + r.createdBefore = &createdBefore + return r +} + +func (r ApiFindProjectUsageRequest) Execute() (*ProjectUsageList, *http.Response, error) { + return r.ApiService.FindProjectUsageExecute(r) +} + +/* +FindProjectUsage Retrieve all usages for project + +Returns all usages for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindProjectUsageRequest +*/ +func (a *UsagesApiService) FindProjectUsage(ctx context.Context, id string) ApiFindProjectUsageRequest { + return ApiFindProjectUsageRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return ProjectUsageList +func (a *UsagesApiService) FindProjectUsageExecute(r ApiFindProjectUsageRequest) (*ProjectUsageList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ProjectUsageList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsagesApiService.FindProjectUsage") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/usages" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.createdAfter != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "created[after]", r.createdAfter, "") + } + if r.createdBefore != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "created[before]", r.createdBefore, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_user_verification_tokens.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_user_verification_tokens.go new file mode 100644 index 00000000..75c4f3bd --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_user_verification_tokens.go @@ -0,0 +1,312 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +// UserVerificationTokensApiService UserVerificationTokensApi service +type UserVerificationTokensApiService service + +type ApiConsumeVerificationRequestRequest struct { + ctx context.Context + ApiService *UserVerificationTokensApiService + verifyEmail *VerifyEmail + include *[]string +} + +// Email to create +func (r ApiConsumeVerificationRequestRequest) VerifyEmail(verifyEmail VerifyEmail) ApiConsumeVerificationRequestRequest { + r.verifyEmail = &verifyEmail + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiConsumeVerificationRequestRequest) Include(include []string) ApiConsumeVerificationRequestRequest { + r.include = &include + return r +} + +func (r ApiConsumeVerificationRequestRequest) Execute() (*http.Response, error) { + return r.ApiService.ConsumeVerificationRequestExecute(r) +} + +/* +ConsumeVerificationRequest Verify a user using an email verification token + +Consumes an email verification token and verifies the user associated with it. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiConsumeVerificationRequestRequest +*/ +func (a *UserVerificationTokensApiService) ConsumeVerificationRequest(ctx context.Context) ApiConsumeVerificationRequestRequest { + return ApiConsumeVerificationRequestRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *UserVerificationTokensApiService) ConsumeVerificationRequestExecute(r ApiConsumeVerificationRequestRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserVerificationTokensApiService.ConsumeVerificationRequest") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/verify-email" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.verifyEmail == nil { + return nil, reportError("verifyEmail is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.verifyEmail + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiCreateValidationRequestRequest struct { + ctx context.Context + ApiService *UserVerificationTokensApiService + login *string + include *[]string +} + +// Email for verification request +func (r ApiCreateValidationRequestRequest) Login(login string) ApiCreateValidationRequestRequest { + r.login = &login + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateValidationRequestRequest) Include(include []string) ApiCreateValidationRequestRequest { + r.include = &include + return r +} + +func (r ApiCreateValidationRequestRequest) Execute() (*http.Response, error) { + return r.ApiService.CreateValidationRequestExecute(r) +} + +/* +CreateValidationRequest Create an email verification request + +Creates an email verification request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateValidationRequestRequest +*/ +func (a *UserVerificationTokensApiService) CreateValidationRequest(ctx context.Context) ApiCreateValidationRequestRequest { + return ApiCreateValidationRequestRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *UserVerificationTokensApiService) CreateValidationRequestExecute(r ApiCreateValidationRequestRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserVerificationTokensApiService.CreateValidationRequest") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/verify-email" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.login == nil { + return nil, reportError("login is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "login", r.login, "") + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_userdata.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_userdata.go new file mode 100644 index 00000000..8ca1ef9b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_userdata.go @@ -0,0 +1,156 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +// UserdataApiService UserdataApi service +type UserdataApiService service + +type ApiValidateUserdataRequest struct { + ctx context.Context + ApiService *UserdataApiService + userdata *string +} + +// Userdata to validate +func (r ApiValidateUserdataRequest) Userdata(userdata string) ApiValidateUserdataRequest { + r.userdata = &userdata + return r +} + +func (r ApiValidateUserdataRequest) Execute() (*http.Response, error) { + return r.ApiService.ValidateUserdataExecute(r) +} + +/* +ValidateUserdata Validate user data + +Validates user data (Userdata) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiValidateUserdataRequest +*/ +func (a *UserdataApiService) ValidateUserdata(ctx context.Context) ApiValidateUserdataRequest { + return ApiValidateUserdataRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *UserdataApiService) ValidateUserdataExecute(r ApiValidateUserdataRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserdataApiService.ValidateUserdata") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/userdata/validate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.userdata != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "userdata", r.userdata, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_users.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_users.go new file mode 100644 index 00000000..11727401 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_users.go @@ -0,0 +1,1175 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// UsersApiService UsersApi service +type UsersApiService service + +type ApiCreateUserRequest struct { + ctx context.Context + ApiService *UsersApiService + userCreateInput *UserCreateInput + include *[]string + exclude *[]string +} + +// User to create +func (r ApiCreateUserRequest) UserCreateInput(userCreateInput UserCreateInput) ApiCreateUserRequest { + r.userCreateInput = &userCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateUserRequest) Include(include []string) ApiCreateUserRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateUserRequest) Exclude(exclude []string) ApiCreateUserRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateUserRequest) Execute() (*User, *http.Response, error) { + return r.ApiService.CreateUserExecute(r) +} + +/* +CreateUser Create a user + +Creates a user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateUserRequest +*/ +func (a *UsersApiService) CreateUser(ctx context.Context) ApiCreateUserRequest { + return ApiCreateUserRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return User +func (a *UsersApiService) CreateUserExecute(r ApiCreateUserRequest) (*User, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.CreateUser") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.userCreateInput == nil { + return localVarReturnValue, nil, reportError("userCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.userCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindCurrentUserRequest struct { + ctx context.Context + ApiService *UsersApiService + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindCurrentUserRequest) Include(include []string) ApiFindCurrentUserRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindCurrentUserRequest) Exclude(exclude []string) ApiFindCurrentUserRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindCurrentUserRequest) Execute() (*User, *http.Response, error) { + return r.ApiService.FindCurrentUserExecute(r) +} + +/* +FindCurrentUser Retrieve the current user + +Returns the user object for the currently logged-in user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindCurrentUserRequest +*/ +func (a *UsersApiService) FindCurrentUser(ctx context.Context) ApiFindCurrentUserRequest { + return ApiFindCurrentUserRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return User +func (a *UsersApiService) FindCurrentUserExecute(r ApiFindCurrentUserRequest) (*User, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.FindCurrentUser") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindInvitationsRequest struct { + ctx context.Context + ApiService *UsersApiService + include *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindInvitationsRequest) Include(include []string) ApiFindInvitationsRequest { + r.include = &include + return r +} + +// Page to return +func (r ApiFindInvitationsRequest) Page(page int32) ApiFindInvitationsRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindInvitationsRequest) PerPage(perPage int32) ApiFindInvitationsRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindInvitationsRequest) Execute() (*InvitationList, *http.Response, error) { + return r.ApiService.FindInvitationsExecute(r) +} + +/* +FindInvitations Retrieve current user invitations + +Returns all invitations in current user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindInvitationsRequest +*/ +func (a *UsersApiService) FindInvitations(ctx context.Context) ApiFindInvitationsRequest { + return ApiFindInvitationsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return InvitationList +func (a *UsersApiService) FindInvitationsExecute(r ApiFindInvitationsRequest) (*InvitationList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InvitationList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.FindInvitations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/invitations" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindUserByIdRequest struct { + ctx context.Context + ApiService *UsersApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindUserByIdRequest) Include(include []string) ApiFindUserByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindUserByIdRequest) Exclude(exclude []string) ApiFindUserByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindUserByIdRequest) Execute() (*User, *http.Response, error) { + return r.ApiService.FindUserByIdExecute(r) +} + +/* +FindUserById Retrieve a user + +Returns a single user if the user has access + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id User UUID + @return ApiFindUserByIdRequest +*/ +func (a *UsersApiService) FindUserById(ctx context.Context, id string) ApiFindUserByIdRequest { + return ApiFindUserByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return User +func (a *UsersApiService) FindUserByIdExecute(r ApiFindUserByIdRequest) (*User, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.FindUserById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindUserCustomdataRequest struct { + ctx context.Context + ApiService *UsersApiService + id string +} + +func (r ApiFindUserCustomdataRequest) Execute() (*http.Response, error) { + return r.ApiService.FindUserCustomdataExecute(r) +} + +/* +FindUserCustomdata Retrieve the custom metadata of a user + +Provides the custom metadata stored for this user in json format + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id User UUID + @return ApiFindUserCustomdataRequest +*/ +func (a *UsersApiService) FindUserCustomdata(ctx context.Context, id string) ApiFindUserCustomdataRequest { + return ApiFindUserCustomdataRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *UsersApiService) FindUserCustomdataExecute(r ApiFindUserCustomdataRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.FindUserCustomdata") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{id}/customdata" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiFindUsersRequest struct { + ctx context.Context + ApiService *UsersApiService + include *[]string + exclude *[]string + page *int32 + perPage *int32 +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindUsersRequest) Include(include []string) ApiFindUsersRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindUsersRequest) Exclude(exclude []string) ApiFindUsersRequest { + r.exclude = &exclude + return r +} + +// Page to return +func (r ApiFindUsersRequest) Page(page int32) ApiFindUsersRequest { + r.page = &page + return r +} + +// Items returned per page +func (r ApiFindUsersRequest) PerPage(perPage int32) ApiFindUsersRequest { + r.perPage = &perPage + return r +} + +func (r ApiFindUsersRequest) Execute() (*UserList, *http.Response, error) { + return r.ApiService.FindUsersExecute(r) +} + +/* +FindUsers Retrieve all users + +Returns a list of users that the are accessible to the current user (all users in the current user’s projects, essentially). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindUsersRequest +*/ +func (a *UsersApiService) FindUsers(ctx context.Context) ApiFindUsersRequest { + return ApiFindUsersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return UserList +func (a *UsersApiService) FindUsersExecute(r ApiFindUsersRequest) (*UserList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UserList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.FindUsers") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "per_page", r.perPage, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ExecuteWithPagination executes the request to fetch and return all pages of results as a single slice +// +// @return UserList +func (r ApiFindUsersRequest) ExecuteWithPagination() (*UserList, error) { + + var items UserList + + pageNumber := int32(1) + + for { + page, _, err := r.Page(pageNumber).Execute() + if err != nil { + return nil, err + } + + items.Users = append(items.Users, page.Users...) + if page.Meta.GetLastPage() <= page.Meta.GetCurrentPage() { + break + } + pageNumber = page.Meta.GetCurrentPage() + 1 + } + + return &items, nil +} + +type ApiUpdateCurrentUserRequest struct { + ctx context.Context + ApiService *UsersApiService + userUpdateInput *UserUpdateInput + include *[]string + exclude *[]string +} + +// User to update +func (r ApiUpdateCurrentUserRequest) UserUpdateInput(userUpdateInput UserUpdateInput) ApiUpdateCurrentUserRequest { + r.userUpdateInput = &userUpdateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateCurrentUserRequest) Include(include []string) ApiUpdateCurrentUserRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiUpdateCurrentUserRequest) Exclude(exclude []string) ApiUpdateCurrentUserRequest { + r.exclude = &exclude + return r +} + +func (r ApiUpdateCurrentUserRequest) Execute() (*User, *http.Response, error) { + return r.ApiService.UpdateCurrentUserExecute(r) +} + +/* +UpdateCurrentUser Update the current user + +Updates the currently logged-in user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiUpdateCurrentUserRequest +*/ +func (a *UsersApiService) UpdateCurrentUser(ctx context.Context) ApiUpdateCurrentUserRequest { + return ApiUpdateCurrentUserRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return User +func (a *UsersApiService) UpdateCurrentUserExecute(r ApiUpdateCurrentUserRequest) (*User, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.UpdateCurrentUser") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.userUpdateInput == nil { + return localVarReturnValue, nil, reportError("userUpdateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.userUpdateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_vlans.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_vlans.go new file mode 100644 index 00000000..bd3bab16 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_vlans.go @@ -0,0 +1,770 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// VLANsApiService VLANsApi service +type VLANsApiService service + +type ApiCreateVirtualNetworkRequest struct { + ctx context.Context + ApiService *VLANsApiService + id string + virtualNetworkCreateInput *VirtualNetworkCreateInput + include *[]string + exclude *[]string +} + +// Virtual Network to create +func (r ApiCreateVirtualNetworkRequest) VirtualNetworkCreateInput(virtualNetworkCreateInput VirtualNetworkCreateInput) ApiCreateVirtualNetworkRequest { + r.virtualNetworkCreateInput = &virtualNetworkCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateVirtualNetworkRequest) Include(include []string) ApiCreateVirtualNetworkRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateVirtualNetworkRequest) Exclude(exclude []string) ApiCreateVirtualNetworkRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateVirtualNetworkRequest) Execute() (*VirtualNetwork, *http.Response, error) { + return r.ApiService.CreateVirtualNetworkExecute(r) +} + +/* +CreateVirtualNetwork Create a virtual network + +Creates an virtual network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiCreateVirtualNetworkRequest +*/ +func (a *VLANsApiService) CreateVirtualNetwork(ctx context.Context, id string) ApiCreateVirtualNetworkRequest { + return ApiCreateVirtualNetworkRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VirtualNetwork +func (a *VLANsApiService) CreateVirtualNetworkExecute(r ApiCreateVirtualNetworkRequest) (*VirtualNetwork, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualNetwork + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VLANsApiService.CreateVirtualNetwork") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/virtual-networks" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.virtualNetworkCreateInput == nil { + return localVarReturnValue, nil, reportError("virtualNetworkCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.virtualNetworkCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteVirtualNetworkRequest struct { + ctx context.Context + ApiService *VLANsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiDeleteVirtualNetworkRequest) Include(include []string) ApiDeleteVirtualNetworkRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiDeleteVirtualNetworkRequest) Exclude(exclude []string) ApiDeleteVirtualNetworkRequest { + r.exclude = &exclude + return r +} + +func (r ApiDeleteVirtualNetworkRequest) Execute() (*VirtualNetwork, *http.Response, error) { + return r.ApiService.DeleteVirtualNetworkExecute(r) +} + +/* +DeleteVirtualNetwork Delete a virtual network + +Deletes a virtual network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Virtual Network UUID + @return ApiDeleteVirtualNetworkRequest +*/ +func (a *VLANsApiService) DeleteVirtualNetwork(ctx context.Context, id string) ApiDeleteVirtualNetworkRequest { + return ApiDeleteVirtualNetworkRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VirtualNetwork +func (a *VLANsApiService) DeleteVirtualNetworkExecute(r ApiDeleteVirtualNetworkRequest) (*VirtualNetwork, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualNetwork + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VLANsApiService.DeleteVirtualNetwork") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/virtual-networks/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindVirtualNetworksRequest struct { + ctx context.Context + ApiService *VLANsApiService + id string + include *[]string + exclude *[]string + facility *string + metro *string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindVirtualNetworksRequest) Include(include []string) ApiFindVirtualNetworksRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindVirtualNetworksRequest) Exclude(exclude []string) ApiFindVirtualNetworksRequest { + r.exclude = &exclude + return r +} + +// Filter by Facility ID (uuid) or Facility Code +// Deprecated +func (r ApiFindVirtualNetworksRequest) Facility(facility string) ApiFindVirtualNetworksRequest { + r.facility = &facility + return r +} + +// Filter by Metro ID (uuid) or Metro Code +func (r ApiFindVirtualNetworksRequest) Metro(metro string) ApiFindVirtualNetworksRequest { + r.metro = &metro + return r +} + +func (r ApiFindVirtualNetworksRequest) Execute() (*VirtualNetworkList, *http.Response, error) { + return r.ApiService.FindVirtualNetworksExecute(r) +} + +/* +FindVirtualNetworks Retrieve all virtual networks + +Provides a list of virtual networks for a single project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindVirtualNetworksRequest +*/ +func (a *VLANsApiService) FindVirtualNetworks(ctx context.Context, id string) ApiFindVirtualNetworksRequest { + return ApiFindVirtualNetworksRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VirtualNetworkList +func (a *VLANsApiService) FindVirtualNetworksExecute(r ApiFindVirtualNetworksRequest) (*VirtualNetworkList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualNetworkList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VLANsApiService.FindVirtualNetworks") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/virtual-networks" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.facility != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "facility", r.facility, "") + } + if r.metro != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "metro", r.metro, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetVirtualNetworkRequest struct { + ctx context.Context + ApiService *VLANsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiGetVirtualNetworkRequest) Include(include []string) ApiGetVirtualNetworkRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiGetVirtualNetworkRequest) Exclude(exclude []string) ApiGetVirtualNetworkRequest { + r.exclude = &exclude + return r +} + +func (r ApiGetVirtualNetworkRequest) Execute() (*VirtualNetwork, *http.Response, error) { + return r.ApiService.GetVirtualNetworkExecute(r) +} + +/* +GetVirtualNetwork Get a virtual network + +Get a virtual network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Virtual Network UUID + @return ApiGetVirtualNetworkRequest +*/ +func (a *VLANsApiService) GetVirtualNetwork(ctx context.Context, id string) ApiGetVirtualNetworkRequest { + return ApiGetVirtualNetworkRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VirtualNetwork +func (a *VLANsApiService) GetVirtualNetworkExecute(r ApiGetVirtualNetworkRequest) (*VirtualNetwork, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualNetwork + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VLANsApiService.GetVirtualNetwork") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/virtual-networks/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_vrfs.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_vrfs.go new file mode 100644 index 00000000..7a9d128c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/api_vrfs.go @@ -0,0 +1,2767 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// VRFsApiService VRFsApi service +type VRFsApiService service + +type ApiBgpDynamicNeighborsIdGetRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiBgpDynamicNeighborsIdGetRequest) Include(include []string) ApiBgpDynamicNeighborsIdGetRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiBgpDynamicNeighborsIdGetRequest) Exclude(exclude []string) ApiBgpDynamicNeighborsIdGetRequest { + r.exclude = &exclude + return r +} + +func (r ApiBgpDynamicNeighborsIdGetRequest) Execute() (*BgpDynamicNeighbor, *http.Response, error) { + return r.ApiService.BgpDynamicNeighborsIdGetExecute(r) +} + +/* +BgpDynamicNeighborsIdGet Retrieve a BGP Dynamic Neighbor + +Return a single BGP Dynamic Neighbor resource + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id BGP Dynamic Neighbor UUID + @return ApiBgpDynamicNeighborsIdGetRequest +*/ +func (a *VRFsApiService) BgpDynamicNeighborsIdGet(ctx context.Context, id string) ApiBgpDynamicNeighborsIdGetRequest { + return ApiBgpDynamicNeighborsIdGetRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BgpDynamicNeighbor +func (a *VRFsApiService) BgpDynamicNeighborsIdGetExecute(r ApiBgpDynamicNeighborsIdGetRequest) (*BgpDynamicNeighbor, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BgpDynamicNeighbor + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.BgpDynamicNeighborsIdGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/bgp-dynamic-neighbors/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateBgpDynamicNeighborRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + bgpDynamicNeighborCreateInput *BgpDynamicNeighborCreateInput + include *[]string + exclude *[]string +} + +func (r ApiCreateBgpDynamicNeighborRequest) BgpDynamicNeighborCreateInput(bgpDynamicNeighborCreateInput BgpDynamicNeighborCreateInput) ApiCreateBgpDynamicNeighborRequest { + r.bgpDynamicNeighborCreateInput = &bgpDynamicNeighborCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateBgpDynamicNeighborRequest) Include(include []string) ApiCreateBgpDynamicNeighborRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateBgpDynamicNeighborRequest) Exclude(exclude []string) ApiCreateBgpDynamicNeighborRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateBgpDynamicNeighborRequest) Execute() (*BgpDynamicNeighbor, *http.Response, error) { + return r.ApiService.CreateBgpDynamicNeighborExecute(r) +} + +/* +CreateBgpDynamicNeighbor Create a VRF BGP Dynamic Neighbor range + +Create a VRF BGP Dynamic Neighbor range. + +BGP Dynamic Neighbor records are limited to 2 per Virtual Network. + +Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Metal Gateway UUID + @return ApiCreateBgpDynamicNeighborRequest +*/ +func (a *VRFsApiService) CreateBgpDynamicNeighbor(ctx context.Context, id string) ApiCreateBgpDynamicNeighborRequest { + return ApiCreateBgpDynamicNeighborRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BgpDynamicNeighbor +func (a *VRFsApiService) CreateBgpDynamicNeighborExecute(r ApiCreateBgpDynamicNeighborRequest) (*BgpDynamicNeighbor, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BgpDynamicNeighbor + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.CreateBgpDynamicNeighbor") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metal-gateways/{id}/bgp-dynamic-neighbors" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.bgpDynamicNeighborCreateInput == nil { + return localVarReturnValue, nil, reportError("bgpDynamicNeighborCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.bgpDynamicNeighborCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateVrfRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + vrfCreateInput *VrfCreateInput + include *[]string + exclude *[]string +} + +// VRF to create +func (r ApiCreateVrfRequest) VrfCreateInput(vrfCreateInput VrfCreateInput) ApiCreateVrfRequest { + r.vrfCreateInput = &vrfCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateVrfRequest) Include(include []string) ApiCreateVrfRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateVrfRequest) Exclude(exclude []string) ApiCreateVrfRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateVrfRequest) Execute() (*Vrf, *http.Response, error) { + return r.ApiService.CreateVrfExecute(r) +} + +/* +CreateVrf Create a new VRF in the specified project + +Creates a new VRF in the specified project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiCreateVrfRequest +*/ +func (a *VRFsApiService) CreateVrf(ctx context.Context, id string) ApiCreateVrfRequest { + return ApiCreateVrfRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Vrf +func (a *VRFsApiService) CreateVrfExecute(r ApiCreateVrfRequest) (*Vrf, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Vrf + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.CreateVrf") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/vrfs" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.vrfCreateInput == nil { + return localVarReturnValue, nil, reportError("vrfCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.vrfCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateVrfRouteRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + vrfRouteCreateInput *VrfRouteCreateInput + include *[]string + exclude *[]string +} + +func (r ApiCreateVrfRouteRequest) VrfRouteCreateInput(vrfRouteCreateInput VrfRouteCreateInput) ApiCreateVrfRouteRequest { + r.vrfRouteCreateInput = &vrfRouteCreateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiCreateVrfRouteRequest) Include(include []string) ApiCreateVrfRouteRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiCreateVrfRouteRequest) Exclude(exclude []string) ApiCreateVrfRouteRequest { + r.exclude = &exclude + return r +} + +func (r ApiCreateVrfRouteRequest) Execute() (*VrfRoute, *http.Response, error) { + return r.ApiService.CreateVrfRouteExecute(r) +} + +/* +CreateVrfRoute Create a VRF route + +Create a route in a VRF. Currently only static default routes are supported. + +Notice: VRFs are a test feature currently under active development, and only available to certain users. Please contact Customer Success for more information. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id VRF UUID + @return ApiCreateVrfRouteRequest +*/ +func (a *VRFsApiService) CreateVrfRoute(ctx context.Context, id string) ApiCreateVrfRouteRequest { + return ApiCreateVrfRouteRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VrfRoute +func (a *VRFsApiService) CreateVrfRouteExecute(r ApiCreateVrfRouteRequest) (*VrfRoute, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VrfRoute + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.CreateVrfRoute") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vrfs/{id}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.vrfRouteCreateInput == nil { + return localVarReturnValue, nil, reportError("vrfRouteCreateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.vrfRouteCreateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteBgpDynamicNeighborByIdRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiDeleteBgpDynamicNeighborByIdRequest) Include(include []string) ApiDeleteBgpDynamicNeighborByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiDeleteBgpDynamicNeighborByIdRequest) Exclude(exclude []string) ApiDeleteBgpDynamicNeighborByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiDeleteBgpDynamicNeighborByIdRequest) Execute() (*BgpDynamicNeighbor, *http.Response, error) { + return r.ApiService.DeleteBgpDynamicNeighborByIdExecute(r) +} + +/* +DeleteBgpDynamicNeighborById Delete a VRF BGP Dynamic Neighbor + +Trigger the removal of a BGP Neighbor range from a VRF + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id BGP Dynamic Neighbor UUID + @return ApiDeleteBgpDynamicNeighborByIdRequest +*/ +func (a *VRFsApiService) DeleteBgpDynamicNeighborById(ctx context.Context, id string) ApiDeleteBgpDynamicNeighborByIdRequest { + return ApiDeleteBgpDynamicNeighborByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BgpDynamicNeighbor +func (a *VRFsApiService) DeleteBgpDynamicNeighborByIdExecute(r ApiDeleteBgpDynamicNeighborByIdRequest) (*BgpDynamicNeighbor, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BgpDynamicNeighbor + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.DeleteBgpDynamicNeighborById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/bgp-dynamic-neighbors/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteVrfRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string +} + +func (r ApiDeleteVrfRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteVrfExecute(r) +} + +/* +DeleteVrf Delete the VRF + +Deletes the VRF + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id VRF UUID + @return ApiDeleteVrfRequest +*/ +func (a *VRFsApiService) DeleteVrf(ctx context.Context, id string) ApiDeleteVrfRequest { + return ApiDeleteVrfRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +func (a *VRFsApiService) DeleteVrfExecute(r ApiDeleteVrfRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.DeleteVrf") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vrfs/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteVrfRouteByIdRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiDeleteVrfRouteByIdRequest) Include(include []string) ApiDeleteVrfRouteByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiDeleteVrfRouteByIdRequest) Exclude(exclude []string) ApiDeleteVrfRouteByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiDeleteVrfRouteByIdRequest) Execute() (*VrfRoute, *http.Response, error) { + return r.ApiService.DeleteVrfRouteByIdExecute(r) +} + +/* +DeleteVrfRouteById Delete a VRF Route + +Trigger the deletion of a VRF Route resource. The status of the route will update to 'deleting', and the route resource will remain accessible while background operations remove the route from the network. Once the route has been removed from the network, the resource will be fully deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id VRF Route UUID + @return ApiDeleteVrfRouteByIdRequest +*/ +func (a *VRFsApiService) DeleteVrfRouteById(ctx context.Context, id string) ApiDeleteVrfRouteByIdRequest { + return ApiDeleteVrfRouteByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VrfRoute +func (a *VRFsApiService) DeleteVrfRouteByIdExecute(r ApiDeleteVrfRouteByIdRequest) (*VrfRoute, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VrfRoute + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.DeleteVrfRouteById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/routes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindVrfByIdRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindVrfByIdRequest) Include(include []string) ApiFindVrfByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindVrfByIdRequest) Exclude(exclude []string) ApiFindVrfByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindVrfByIdRequest) Execute() (*Vrf, *http.Response, error) { + return r.ApiService.FindVrfByIdExecute(r) +} + +/* +FindVrfById Retrieve a VRF + +Returns a single VRF resource + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id VRF UUID + @return ApiFindVrfByIdRequest +*/ +func (a *VRFsApiService) FindVrfById(ctx context.Context, id string) ApiFindVrfByIdRequest { + return ApiFindVrfByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Vrf +func (a *VRFsApiService) FindVrfByIdExecute(r ApiFindVrfByIdRequest) (*Vrf, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Vrf + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.FindVrfById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vrfs/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindVrfIpReservationRequest struct { + ctx context.Context + ApiService *VRFsApiService + vrfId string + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindVrfIpReservationRequest) Include(include []string) ApiFindVrfIpReservationRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindVrfIpReservationRequest) Exclude(exclude []string) ApiFindVrfIpReservationRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindVrfIpReservationRequest) Execute() (*VrfIpReservation, *http.Response, error) { + return r.ApiService.FindVrfIpReservationExecute(r) +} + +/* +FindVrfIpReservation Retrieve all VRF IP Reservations in the VRF + +Returns the IP Reservation for the VRF. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param vrfId VRF UUID + @param id IP UUID + @return ApiFindVrfIpReservationRequest +*/ +func (a *VRFsApiService) FindVrfIpReservation(ctx context.Context, vrfId string, id string) ApiFindVrfIpReservationRequest { + return ApiFindVrfIpReservationRequest{ + ApiService: a, + ctx: ctx, + vrfId: vrfId, + id: id, + } +} + +// Execute executes the request +// +// @return VrfIpReservation +func (a *VRFsApiService) FindVrfIpReservationExecute(r ApiFindVrfIpReservationRequest) (*VrfIpReservation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VrfIpReservation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.FindVrfIpReservation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vrfs/{vrf_id}/ips/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"vrf_id"+"}", url.PathEscape(parameterValueToString(r.vrfId, "vrfId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindVrfIpReservationsRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindVrfIpReservationsRequest) Include(include []string) ApiFindVrfIpReservationsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindVrfIpReservationsRequest) Exclude(exclude []string) ApiFindVrfIpReservationsRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindVrfIpReservationsRequest) Execute() (*VrfIpReservationList, *http.Response, error) { + return r.ApiService.FindVrfIpReservationsExecute(r) +} + +/* +FindVrfIpReservations Retrieve all VRF IP Reservations in the VRF + +Returns the list of VRF IP Reservations for the VRF. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id VRF UUID + @return ApiFindVrfIpReservationsRequest +*/ +func (a *VRFsApiService) FindVrfIpReservations(ctx context.Context, id string) ApiFindVrfIpReservationsRequest { + return ApiFindVrfIpReservationsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VrfIpReservationList +func (a *VRFsApiService) FindVrfIpReservationsExecute(r ApiFindVrfIpReservationsRequest) (*VrfIpReservationList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VrfIpReservationList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.FindVrfIpReservations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vrfs/{id}/ips" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindVrfRouteByIdRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindVrfRouteByIdRequest) Include(include []string) ApiFindVrfRouteByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindVrfRouteByIdRequest) Exclude(exclude []string) ApiFindVrfRouteByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiFindVrfRouteByIdRequest) Execute() (*VrfRoute, *http.Response, error) { + return r.ApiService.FindVrfRouteByIdExecute(r) +} + +/* +FindVrfRouteById Retrieve a VRF Route + +Returns a single VRF Route resource + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id VRF Route UUID + @return ApiFindVrfRouteByIdRequest +*/ +func (a *VRFsApiService) FindVrfRouteById(ctx context.Context, id string) ApiFindVrfRouteByIdRequest { + return ApiFindVrfRouteByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VrfRoute +func (a *VRFsApiService) FindVrfRouteByIdExecute(r ApiFindVrfRouteByIdRequest) (*VrfRoute, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VrfRoute + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.FindVrfRouteById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/routes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindVrfsRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + include *[]string + exclude *[]string + metro *string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiFindVrfsRequest) Include(include []string) ApiFindVrfsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiFindVrfsRequest) Exclude(exclude []string) ApiFindVrfsRequest { + r.exclude = &exclude + return r +} + +// Filter by Metro ID (uuid) or Metro Code +func (r ApiFindVrfsRequest) Metro(metro string) ApiFindVrfsRequest { + r.metro = &metro + return r +} + +func (r ApiFindVrfsRequest) Execute() (*VrfList, *http.Response, error) { + return r.ApiService.FindVrfsExecute(r) +} + +/* +FindVrfs Retrieve all VRFs in the project + +Returns the list of VRFs for a single project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Project UUID + @return ApiFindVrfsRequest +*/ +func (a *VRFsApiService) FindVrfs(ctx context.Context, id string) ApiFindVrfsRequest { + return ApiFindVrfsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VrfList +func (a *VRFsApiService) FindVrfsExecute(r ApiFindVrfsRequest) (*VrfList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VrfList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.FindVrfs") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/projects/{id}/vrfs" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + if r.metro != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "metro", r.metro, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetBgpDynamicNeighborsRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiGetBgpDynamicNeighborsRequest) Include(include []string) ApiGetBgpDynamicNeighborsRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiGetBgpDynamicNeighborsRequest) Exclude(exclude []string) ApiGetBgpDynamicNeighborsRequest { + r.exclude = &exclude + return r +} + +func (r ApiGetBgpDynamicNeighborsRequest) Execute() (*BgpDynamicNeighborList, *http.Response, error) { + return r.ApiService.GetBgpDynamicNeighborsExecute(r) +} + +/* +GetBgpDynamicNeighbors List BGP Dynamic Neighbors + +Returns the list of VRF BGP Dynamic Neighbors for this Metal Gateway + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Metal Gateway UUID + @return ApiGetBgpDynamicNeighborsRequest +*/ +func (a *VRFsApiService) GetBgpDynamicNeighbors(ctx context.Context, id string) ApiGetBgpDynamicNeighborsRequest { + return ApiGetBgpDynamicNeighborsRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return BgpDynamicNeighborList +func (a *VRFsApiService) GetBgpDynamicNeighborsExecute(r ApiGetBgpDynamicNeighborsRequest) (*BgpDynamicNeighborList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BgpDynamicNeighborList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.GetBgpDynamicNeighbors") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metal-gateways/{id}/bgp-dynamic-neighbors" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetVrfRoutesRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + include *[]string + exclude *[]string +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiGetVrfRoutesRequest) Include(include []string) ApiGetVrfRoutesRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiGetVrfRoutesRequest) Exclude(exclude []string) ApiGetVrfRoutesRequest { + r.exclude = &exclude + return r +} + +func (r ApiGetVrfRoutesRequest) Execute() (*VrfRouteList, *http.Response, error) { + return r.ApiService.GetVrfRoutesExecute(r) +} + +/* +GetVrfRoutes Retrieve all routes in the VRF + +Returns the list of routes for the VRF + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id VRF UUID + @return ApiGetVrfRoutesRequest +*/ +func (a *VRFsApiService) GetVrfRoutes(ctx context.Context, id string) ApiGetVrfRoutesRequest { + return ApiGetVrfRoutesRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VrfRouteList +func (a *VRFsApiService) GetVrfRoutesExecute(r ApiGetVrfRoutesRequest) (*VrfRouteList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VrfRouteList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.GetVrfRoutes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vrfs/{id}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateVrfRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + vrfUpdateInput *VrfUpdateInput + include *[]string + exclude *[]string +} + +// VRF to update +func (r ApiUpdateVrfRequest) VrfUpdateInput(vrfUpdateInput VrfUpdateInput) ApiUpdateVrfRequest { + r.vrfUpdateInput = &vrfUpdateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateVrfRequest) Include(include []string) ApiUpdateVrfRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiUpdateVrfRequest) Exclude(exclude []string) ApiUpdateVrfRequest { + r.exclude = &exclude + return r +} + +func (r ApiUpdateVrfRequest) Execute() (*Vrf, *http.Response, error) { + return r.ApiService.UpdateVrfExecute(r) +} + +/* +UpdateVrf Update the VRF + +Updates the VRF. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id VRF UUID + @return ApiUpdateVrfRequest +*/ +func (a *VRFsApiService) UpdateVrf(ctx context.Context, id string) ApiUpdateVrfRequest { + return ApiUpdateVrfRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return Vrf +func (a *VRFsApiService) UpdateVrfExecute(r ApiUpdateVrfRequest) (*Vrf, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Vrf + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.UpdateVrf") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vrfs/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.vrfUpdateInput == nil { + return localVarReturnValue, nil, reportError("vrfUpdateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.vrfUpdateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateVrfRouteByIdRequest struct { + ctx context.Context + ApiService *VRFsApiService + id string + vrfRouteUpdateInput *VrfRouteUpdateInput + include *[]string + exclude *[]string +} + +func (r ApiUpdateVrfRouteByIdRequest) VrfRouteUpdateInput(vrfRouteUpdateInput VrfRouteUpdateInput) ApiUpdateVrfRouteByIdRequest { + r.vrfRouteUpdateInput = &vrfRouteUpdateInput + return r +} + +// Nested attributes to include. Included objects will return their full attributes. Attribute names can be dotted (up to 3 levels) to included deeply nested objects. +func (r ApiUpdateVrfRouteByIdRequest) Include(include []string) ApiUpdateVrfRouteByIdRequest { + r.include = &include + return r +} + +// Nested attributes to exclude. Excluded objects will return only the href attribute. Attribute names can be dotted (up to 3 levels) to exclude deeply nested objects. +func (r ApiUpdateVrfRouteByIdRequest) Exclude(exclude []string) ApiUpdateVrfRouteByIdRequest { + r.exclude = &exclude + return r +} + +func (r ApiUpdateVrfRouteByIdRequest) Execute() (*VrfRoute, *http.Response, error) { + return r.ApiService.UpdateVrfRouteByIdExecute(r) +} + +/* +UpdateVrfRouteById Update a VRF Route + +Requests a VRF Route be redeployed across the network. Updating the prefix or next-hop address on a route is not currently supported. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id VRF Route UUID + @return ApiUpdateVrfRouteByIdRequest +*/ +func (a *VRFsApiService) UpdateVrfRouteById(ctx context.Context, id string) ApiUpdateVrfRouteByIdRequest { + return ApiUpdateVrfRouteByIdRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// +// @return VrfRoute +func (a *VRFsApiService) UpdateVrfRouteByIdExecute(r ApiUpdateVrfRouteByIdRequest) (*VrfRoute, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VrfRoute + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VRFsApiService.UpdateVrfRouteById") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/routes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.vrfRouteUpdateInput == nil { + return localVarReturnValue, nil, reportError("vrfRouteUpdateInput is required and must be specified") + } + + if r.include != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "include", r.include, "csv") + } + if r.exclude != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude", r.exclude, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.vrfRouteUpdateInput + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["x_auth_token"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Auth-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/client.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/client.go new file mode 100644 index 00000000..ccdfadb9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/client.go @@ -0,0 +1,842 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the Metal API API v1.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + AuthenticationApi *AuthenticationApiService + + BGPApi *BGPApiService + + BatchesApi *BatchesApiService + + CapacityApi *CapacityApiService + + ConsoleLogDetailsApi *ConsoleLogDetailsApiService + + DevicesApi *DevicesApiService + + EmailsApi *EmailsApiService + + EventsApi *EventsApiService + + FacilitiesApi *FacilitiesApiService + + FirmwareSetsApi *FirmwareSetsApiService + + HardwareReservationsApi *HardwareReservationsApiService + + IPAddressesApi *IPAddressesApiService + + IncidentsApi *IncidentsApiService + + InterconnectionsApi *InterconnectionsApiService + + InvitationsApi *InvitationsApiService + + InvoicesApi *InvoicesApiService + + LicensesApi *LicensesApiService + + MembershipsApi *MembershipsApiService + + MetalGatewaysApi *MetalGatewaysApiService + + MetrosApi *MetrosApiService + + OTPsApi *OTPsApiService + + OperatingSystemsApi *OperatingSystemsApiService + + OrganizationsApi *OrganizationsApiService + + PasswordResetTokensApi *PasswordResetTokensApiService + + PaymentMethodsApi *PaymentMethodsApiService + + PlansApi *PlansApiService + + PortsApi *PortsApiService + + ProjectsApi *ProjectsApiService + + SSHKeysApi *SSHKeysApiService + + SelfServiceReservationsApi *SelfServiceReservationsApiService + + SpotMarketApi *SpotMarketApiService + + SupportRequestApi *SupportRequestApiService + + TransferRequestsApi *TransferRequestsApiService + + TwoFactorAuthApi *TwoFactorAuthApiService + + UsagesApi *UsagesApiService + + UserVerificationTokensApi *UserVerificationTokensApiService + + UserdataApi *UserdataApiService + + UsersApi *UsersApiService + + VLANsApi *VLANsApiService + + VRFsApi *VRFsApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.AuthenticationApi = (*AuthenticationApiService)(&c.common) + c.BGPApi = (*BGPApiService)(&c.common) + c.BatchesApi = (*BatchesApiService)(&c.common) + c.CapacityApi = (*CapacityApiService)(&c.common) + c.ConsoleLogDetailsApi = (*ConsoleLogDetailsApiService)(&c.common) + c.DevicesApi = (*DevicesApiService)(&c.common) + c.EmailsApi = (*EmailsApiService)(&c.common) + c.EventsApi = (*EventsApiService)(&c.common) + c.FacilitiesApi = (*FacilitiesApiService)(&c.common) + c.FirmwareSetsApi = (*FirmwareSetsApiService)(&c.common) + c.HardwareReservationsApi = (*HardwareReservationsApiService)(&c.common) + c.IPAddressesApi = (*IPAddressesApiService)(&c.common) + c.IncidentsApi = (*IncidentsApiService)(&c.common) + c.InterconnectionsApi = (*InterconnectionsApiService)(&c.common) + c.InvitationsApi = (*InvitationsApiService)(&c.common) + c.InvoicesApi = (*InvoicesApiService)(&c.common) + c.LicensesApi = (*LicensesApiService)(&c.common) + c.MembershipsApi = (*MembershipsApiService)(&c.common) + c.MetalGatewaysApi = (*MetalGatewaysApiService)(&c.common) + c.MetrosApi = (*MetrosApiService)(&c.common) + c.OTPsApi = (*OTPsApiService)(&c.common) + c.OperatingSystemsApi = (*OperatingSystemsApiService)(&c.common) + c.OrganizationsApi = (*OrganizationsApiService)(&c.common) + c.PasswordResetTokensApi = (*PasswordResetTokensApiService)(&c.common) + c.PaymentMethodsApi = (*PaymentMethodsApiService)(&c.common) + c.PlansApi = (*PlansApiService)(&c.common) + c.PortsApi = (*PortsApiService)(&c.common) + c.ProjectsApi = (*ProjectsApiService)(&c.common) + c.SSHKeysApi = (*SSHKeysApiService)(&c.common) + c.SelfServiceReservationsApi = (*SelfServiceReservationsApiService)(&c.common) + c.SpotMarketApi = (*SpotMarketApiService)(&c.common) + c.SupportRequestApi = (*SupportRequestApiService)(&c.common) + c.TransferRequestsApi = (*TransferRequestsApiService)(&c.common) + c.TwoFactorAuthApi = (*TwoFactorAuthApiService)(&c.common) + c.UsagesApi = (*UsagesApiService)(&c.common) + c.UserVerificationTokensApi = (*UserVerificationTokensApiService)(&c.common) + c.UserdataApi = (*UserdataApiService)(&c.common) + c.UsersApi = (*UsersApiService)(&c.common) + c.VLANsApi = (*VLANsApiService)(&c.common) + c.VRFsApi = (*VRFsApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + authToken, hasAuth := request.Header["X-Auth-Token"] + if hasAuth { + request.Header.Set("X-Auth-Token", "**REDACTED**") + } + + dump, err := httputil.DumpRequestOut(request, true) + + if hasAuth { + request.Header["X-Auth-Token"] = authToken + } + + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + dumpDeprecation(resp) + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model is an instance of +// the Error component schema or when it implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + errorModel, ok := v.(*Error) + + if ok { + errs := []string{} + errs = append(errs, errorModel.GetErrors()...) + if errorModel.GetError() != "" { + errs = append(errs, errorModel.GetError()) + } + str = strings.Join(errs, ", ") + } else { + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} + +// dumpDeprecation logs headers defined by +// https://tools.ietf.org/html/rfc8594 +// copied from https://github.com/packngo +// for backwards compatibility +func dumpDeprecation(resp *http.Response) { + uri := "" + if resp.Request != nil { + uri = resp.Request.Method + " " + resp.Request.URL.Path + } + + deprecation := resp.Header.Get("Deprecation") + if deprecation != "" { + if deprecation == "true" { + deprecation = "" + } else { + deprecation = " on " + deprecation + } + log.Printf("WARNING: %q reported deprecation%s", uri, deprecation) + } + + sunset := resp.Header.Get("Sunset") + if sunset != "" { + log.Printf("WARNING: %q reported sunsetting on %s", uri, sunset) + } + + links := resp.Header.Values("Link") + + for _, s := range links { + for _, ss := range strings.Split(s, ",") { + if strings.Contains(ss, "rel=\"sunset\"") { + link := strings.Split(ss, ";")[0] + log.Printf("WARNING: See %s for sunset details", link) + } else if strings.Contains(ss, "rel=\"deprecation\"") { + link := strings.Split(ss, ";")[0] + log.Printf("WARNING: See %s for deprecation details", link) + } + } + } +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/configuration.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/configuration.go new file mode 100644 index 00000000..2e1e071a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/configuration.go @@ -0,0 +1,218 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "equinix-sdk-go/0.33.0", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "https://api.equinix.com/metal/v1", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{}, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_activate_hardware_reservation_request.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_activate_hardware_reservation_request.go new file mode 100644 index 00000000..a046b303 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_activate_hardware_reservation_request.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the ActivateHardwareReservationRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ActivateHardwareReservationRequest{} + +// ActivateHardwareReservationRequest struct for ActivateHardwareReservationRequest +type ActivateHardwareReservationRequest struct { + Description *string `json:"description,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ActivateHardwareReservationRequest ActivateHardwareReservationRequest + +// NewActivateHardwareReservationRequest instantiates a new ActivateHardwareReservationRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewActivateHardwareReservationRequest() *ActivateHardwareReservationRequest { + this := ActivateHardwareReservationRequest{} + return &this +} + +// NewActivateHardwareReservationRequestWithDefaults instantiates a new ActivateHardwareReservationRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewActivateHardwareReservationRequestWithDefaults() *ActivateHardwareReservationRequest { + this := ActivateHardwareReservationRequest{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *ActivateHardwareReservationRequest) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActivateHardwareReservationRequest) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *ActivateHardwareReservationRequest) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *ActivateHardwareReservationRequest) SetDescription(v string) { + o.Description = &v +} + +func (o ActivateHardwareReservationRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ActivateHardwareReservationRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ActivateHardwareReservationRequest) UnmarshalJSON(data []byte) (err error) { + varActivateHardwareReservationRequest := _ActivateHardwareReservationRequest{} + + err = json.Unmarshal(data, &varActivateHardwareReservationRequest) + + if err != nil { + return err + } + + *o = ActivateHardwareReservationRequest(varActivateHardwareReservationRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableActivateHardwareReservationRequest struct { + value *ActivateHardwareReservationRequest + isSet bool +} + +func (v NullableActivateHardwareReservationRequest) Get() *ActivateHardwareReservationRequest { + return v.value +} + +func (v *NullableActivateHardwareReservationRequest) Set(val *ActivateHardwareReservationRequest) { + v.value = val + v.isSet = true +} + +func (v NullableActivateHardwareReservationRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableActivateHardwareReservationRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableActivateHardwareReservationRequest(val *ActivateHardwareReservationRequest) *NullableActivateHardwareReservationRequest { + return &NullableActivateHardwareReservationRequest{value: val, isSet: true} +} + +func (v NullableActivateHardwareReservationRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableActivateHardwareReservationRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_address.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_address.go new file mode 100644 index 00000000..43251091 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_address.go @@ -0,0 +1,373 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the Address type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Address{} + +// Address struct for Address +type Address struct { + Address string `json:"address"` + Address2 *string `json:"address2,omitempty"` + City *string `json:"city,omitempty"` + Coordinates *Coordinates `json:"coordinates,omitempty"` + Country string `json:"country"` + State *string `json:"state,omitempty"` + ZipCode string `json:"zip_code"` + AdditionalProperties map[string]interface{} +} + +type _Address Address + +// NewAddress instantiates a new Address object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAddress(address string, country string, zipCode string) *Address { + this := Address{} + this.Address = address + this.Country = country + this.ZipCode = zipCode + return &this +} + +// NewAddressWithDefaults instantiates a new Address object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAddressWithDefaults() *Address { + this := Address{} + return &this +} + +// GetAddress returns the Address field value +func (o *Address) GetAddress() string { + if o == nil { + var ret string + return ret + } + + return o.Address +} + +// GetAddressOk returns a tuple with the Address field value +// and a boolean to check if the value has been set. +func (o *Address) GetAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Address, true +} + +// SetAddress sets field value +func (o *Address) SetAddress(v string) { + o.Address = v +} + +// GetAddress2 returns the Address2 field value if set, zero value otherwise. +func (o *Address) GetAddress2() string { + if o == nil || IsNil(o.Address2) { + var ret string + return ret + } + return *o.Address2 +} + +// GetAddress2Ok returns a tuple with the Address2 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Address) GetAddress2Ok() (*string, bool) { + if o == nil || IsNil(o.Address2) { + return nil, false + } + return o.Address2, true +} + +// HasAddress2 returns a boolean if a field has been set. +func (o *Address) HasAddress2() bool { + if o != nil && !IsNil(o.Address2) { + return true + } + + return false +} + +// SetAddress2 gets a reference to the given string and assigns it to the Address2 field. +func (o *Address) SetAddress2(v string) { + o.Address2 = &v +} + +// GetCity returns the City field value if set, zero value otherwise. +func (o *Address) GetCity() string { + if o == nil || IsNil(o.City) { + var ret string + return ret + } + return *o.City +} + +// GetCityOk returns a tuple with the City field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Address) GetCityOk() (*string, bool) { + if o == nil || IsNil(o.City) { + return nil, false + } + return o.City, true +} + +// HasCity returns a boolean if a field has been set. +func (o *Address) HasCity() bool { + if o != nil && !IsNil(o.City) { + return true + } + + return false +} + +// SetCity gets a reference to the given string and assigns it to the City field. +func (o *Address) SetCity(v string) { + o.City = &v +} + +// GetCoordinates returns the Coordinates field value if set, zero value otherwise. +func (o *Address) GetCoordinates() Coordinates { + if o == nil || IsNil(o.Coordinates) { + var ret Coordinates + return ret + } + return *o.Coordinates +} + +// GetCoordinatesOk returns a tuple with the Coordinates field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Address) GetCoordinatesOk() (*Coordinates, bool) { + if o == nil || IsNil(o.Coordinates) { + return nil, false + } + return o.Coordinates, true +} + +// HasCoordinates returns a boolean if a field has been set. +func (o *Address) HasCoordinates() bool { + if o != nil && !IsNil(o.Coordinates) { + return true + } + + return false +} + +// SetCoordinates gets a reference to the given Coordinates and assigns it to the Coordinates field. +func (o *Address) SetCoordinates(v Coordinates) { + o.Coordinates = &v +} + +// GetCountry returns the Country field value +func (o *Address) GetCountry() string { + if o == nil { + var ret string + return ret + } + + return o.Country +} + +// GetCountryOk returns a tuple with the Country field value +// and a boolean to check if the value has been set. +func (o *Address) GetCountryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Country, true +} + +// SetCountry sets field value +func (o *Address) SetCountry(v string) { + o.Country = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Address) GetState() string { + if o == nil || IsNil(o.State) { + var ret string + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Address) GetStateOk() (*string, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Address) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *Address) SetState(v string) { + o.State = &v +} + +// GetZipCode returns the ZipCode field value +func (o *Address) GetZipCode() string { + if o == nil { + var ret string + return ret + } + + return o.ZipCode +} + +// GetZipCodeOk returns a tuple with the ZipCode field value +// and a boolean to check if the value has been set. +func (o *Address) GetZipCodeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ZipCode, true +} + +// SetZipCode sets field value +func (o *Address) SetZipCode(v string) { + o.ZipCode = v +} + +func (o Address) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Address) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["address"] = o.Address + if !IsNil(o.Address2) { + toSerialize["address2"] = o.Address2 + } + if !IsNil(o.City) { + toSerialize["city"] = o.City + } + if !IsNil(o.Coordinates) { + toSerialize["coordinates"] = o.Coordinates + } + toSerialize["country"] = o.Country + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + toSerialize["zip_code"] = o.ZipCode + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Address) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "address", + "country", + "zip_code", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAddress := _Address{} + + err = json.Unmarshal(data, &varAddress) + + if err != nil { + return err + } + + *o = Address(varAddress) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "address2") + delete(additionalProperties, "city") + delete(additionalProperties, "coordinates") + delete(additionalProperties, "country") + delete(additionalProperties, "state") + delete(additionalProperties, "zip_code") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAddress struct { + value *Address + isSet bool +} + +func (v NullableAddress) Get() *Address { + return v.value +} + +func (v *NullableAddress) Set(val *Address) { + v.value = val + v.isSet = true +} + +func (v NullableAddress) IsSet() bool { + return v.isSet +} + +func (v *NullableAddress) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddress(val *Address) *NullableAddress { + return &NullableAddress{value: val, isSet: true} +} + +func (v NullableAddress) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddress) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_attribute.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_attribute.go new file mode 100644 index 00000000..b8f44ec1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_attribute.go @@ -0,0 +1,269 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the Attribute type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Attribute{} + +// Attribute struct for Attribute +type Attribute struct { + // Attribute namespace + Namespace *string `json:"namespace,omitempty"` + // Datetime when the block was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Datetime when the block was updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + Data *AttributeData `json:"data,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Attribute Attribute + +// NewAttribute instantiates a new Attribute object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAttribute() *Attribute { + this := Attribute{} + return &this +} + +// NewAttributeWithDefaults instantiates a new Attribute object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAttributeWithDefaults() *Attribute { + this := Attribute{} + return &this +} + +// GetNamespace returns the Namespace field value if set, zero value otherwise. +func (o *Attribute) GetNamespace() string { + if o == nil || IsNil(o.Namespace) { + var ret string + return ret + } + return *o.Namespace +} + +// GetNamespaceOk returns a tuple with the Namespace field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Attribute) GetNamespaceOk() (*string, bool) { + if o == nil || IsNil(o.Namespace) { + return nil, false + } + return o.Namespace, true +} + +// HasNamespace returns a boolean if a field has been set. +func (o *Attribute) HasNamespace() bool { + if o != nil && !IsNil(o.Namespace) { + return true + } + + return false +} + +// SetNamespace gets a reference to the given string and assigns it to the Namespace field. +func (o *Attribute) SetNamespace(v string) { + o.Namespace = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Attribute) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Attribute) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Attribute) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Attribute) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Attribute) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Attribute) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Attribute) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Attribute) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *Attribute) GetData() AttributeData { + if o == nil || IsNil(o.Data) { + var ret AttributeData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Attribute) GetDataOk() (*AttributeData, bool) { + if o == nil || IsNil(o.Data) { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *Attribute) HasData() bool { + if o != nil && !IsNil(o.Data) { + return true + } + + return false +} + +// SetData gets a reference to the given AttributeData and assigns it to the Data field. +func (o *Attribute) SetData(v AttributeData) { + o.Data = &v +} + +func (o Attribute) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Attribute) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Namespace) { + toSerialize["namespace"] = o.Namespace + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Data) { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Attribute) UnmarshalJSON(data []byte) (err error) { + varAttribute := _Attribute{} + + err = json.Unmarshal(data, &varAttribute) + + if err != nil { + return err + } + + *o = Attribute(varAttribute) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "namespace") + delete(additionalProperties, "created_at") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "data") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAttribute struct { + value *Attribute + isSet bool +} + +func (v NullableAttribute) Get() *Attribute { + return v.value +} + +func (v *NullableAttribute) Set(val *Attribute) { + v.value = val + v.isSet = true +} + +func (v NullableAttribute) IsSet() bool { + return v.isSet +} + +func (v *NullableAttribute) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAttribute(val *Attribute) *NullableAttribute { + return &NullableAttribute{value: val, isSet: true} +} + +func (v NullableAttribute) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAttribute) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_attribute_data.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_attribute_data.go new file mode 100644 index 00000000..d692c563 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_attribute_data.go @@ -0,0 +1,269 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the AttributeData type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AttributeData{} + +// AttributeData struct for AttributeData +type AttributeData struct { + // Boolean flag to know if the firmware set is the latest for the model and vendor + Latest *bool `json:"latest,omitempty"` + // Model on which this firmware set can be applied + Model *string `json:"model,omitempty"` + // Vendor on which this firmware set can be applied + Vendor *string `json:"vendor,omitempty"` + // Plan where the firmware set can be applied + Plan *string `json:"plan,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AttributeData AttributeData + +// NewAttributeData instantiates a new AttributeData object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAttributeData() *AttributeData { + this := AttributeData{} + return &this +} + +// NewAttributeDataWithDefaults instantiates a new AttributeData object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAttributeDataWithDefaults() *AttributeData { + this := AttributeData{} + return &this +} + +// GetLatest returns the Latest field value if set, zero value otherwise. +func (o *AttributeData) GetLatest() bool { + if o == nil || IsNil(o.Latest) { + var ret bool + return ret + } + return *o.Latest +} + +// GetLatestOk returns a tuple with the Latest field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AttributeData) GetLatestOk() (*bool, bool) { + if o == nil || IsNil(o.Latest) { + return nil, false + } + return o.Latest, true +} + +// HasLatest returns a boolean if a field has been set. +func (o *AttributeData) HasLatest() bool { + if o != nil && !IsNil(o.Latest) { + return true + } + + return false +} + +// SetLatest gets a reference to the given bool and assigns it to the Latest field. +func (o *AttributeData) SetLatest(v bool) { + o.Latest = &v +} + +// GetModel returns the Model field value if set, zero value otherwise. +func (o *AttributeData) GetModel() string { + if o == nil || IsNil(o.Model) { + var ret string + return ret + } + return *o.Model +} + +// GetModelOk returns a tuple with the Model field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AttributeData) GetModelOk() (*string, bool) { + if o == nil || IsNil(o.Model) { + return nil, false + } + return o.Model, true +} + +// HasModel returns a boolean if a field has been set. +func (o *AttributeData) HasModel() bool { + if o != nil && !IsNil(o.Model) { + return true + } + + return false +} + +// SetModel gets a reference to the given string and assigns it to the Model field. +func (o *AttributeData) SetModel(v string) { + o.Model = &v +} + +// GetVendor returns the Vendor field value if set, zero value otherwise. +func (o *AttributeData) GetVendor() string { + if o == nil || IsNil(o.Vendor) { + var ret string + return ret + } + return *o.Vendor +} + +// GetVendorOk returns a tuple with the Vendor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AttributeData) GetVendorOk() (*string, bool) { + if o == nil || IsNil(o.Vendor) { + return nil, false + } + return o.Vendor, true +} + +// HasVendor returns a boolean if a field has been set. +func (o *AttributeData) HasVendor() bool { + if o != nil && !IsNil(o.Vendor) { + return true + } + + return false +} + +// SetVendor gets a reference to the given string and assigns it to the Vendor field. +func (o *AttributeData) SetVendor(v string) { + o.Vendor = &v +} + +// GetPlan returns the Plan field value if set, zero value otherwise. +func (o *AttributeData) GetPlan() string { + if o == nil || IsNil(o.Plan) { + var ret string + return ret + } + return *o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AttributeData) GetPlanOk() (*string, bool) { + if o == nil || IsNil(o.Plan) { + return nil, false + } + return o.Plan, true +} + +// HasPlan returns a boolean if a field has been set. +func (o *AttributeData) HasPlan() bool { + if o != nil && !IsNil(o.Plan) { + return true + } + + return false +} + +// SetPlan gets a reference to the given string and assigns it to the Plan field. +func (o *AttributeData) SetPlan(v string) { + o.Plan = &v +} + +func (o AttributeData) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AttributeData) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Latest) { + toSerialize["latest"] = o.Latest + } + if !IsNil(o.Model) { + toSerialize["model"] = o.Model + } + if !IsNil(o.Vendor) { + toSerialize["vendor"] = o.Vendor + } + if !IsNil(o.Plan) { + toSerialize["plan"] = o.Plan + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AttributeData) UnmarshalJSON(data []byte) (err error) { + varAttributeData := _AttributeData{} + + err = json.Unmarshal(data, &varAttributeData) + + if err != nil { + return err + } + + *o = AttributeData(varAttributeData) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "latest") + delete(additionalProperties, "model") + delete(additionalProperties, "vendor") + delete(additionalProperties, "plan") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAttributeData struct { + value *AttributeData + isSet bool +} + +func (v NullableAttributeData) Get() *AttributeData { + return v.value +} + +func (v *NullableAttributeData) Set(val *AttributeData) { + v.value = val + v.isSet = true +} + +func (v NullableAttributeData) IsSet() bool { + return v.isSet +} + +func (v *NullableAttributeData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAttributeData(val *AttributeData) *NullableAttributeData { + return &NullableAttributeData{value: val, isSet: true} +} + +func (v NullableAttributeData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAttributeData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token.go new file mode 100644 index 00000000..33241185 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token.go @@ -0,0 +1,415 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the AuthToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuthToken{} + +// AuthToken struct for AuthToken +type AuthToken struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + // Available only for API keys + Description *string `json:"description,omitempty"` + Id *string `json:"id,omitempty"` + Project *AuthTokenProject `json:"project,omitempty"` + ReadOnly *bool `json:"read_only,omitempty"` + Token *string `json:"token,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + User *AuthTokenUser `json:"user,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AuthToken AuthToken + +// NewAuthToken instantiates a new AuthToken object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAuthToken() *AuthToken { + this := AuthToken{} + return &this +} + +// NewAuthTokenWithDefaults instantiates a new AuthToken object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAuthTokenWithDefaults() *AuthToken { + this := AuthToken{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *AuthToken) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthToken) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *AuthToken) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *AuthToken) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AuthToken) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthToken) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *AuthToken) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AuthToken) SetDescription(v string) { + o.Description = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AuthToken) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthToken) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *AuthToken) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AuthToken) SetId(v string) { + o.Id = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *AuthToken) GetProject() AuthTokenProject { + if o == nil || IsNil(o.Project) { + var ret AuthTokenProject + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthToken) GetProjectOk() (*AuthTokenProject, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *AuthToken) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given AuthTokenProject and assigns it to the Project field. +func (o *AuthToken) SetProject(v AuthTokenProject) { + o.Project = &v +} + +// GetReadOnly returns the ReadOnly field value if set, zero value otherwise. +func (o *AuthToken) GetReadOnly() bool { + if o == nil || IsNil(o.ReadOnly) { + var ret bool + return ret + } + return *o.ReadOnly +} + +// GetReadOnlyOk returns a tuple with the ReadOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthToken) GetReadOnlyOk() (*bool, bool) { + if o == nil || IsNil(o.ReadOnly) { + return nil, false + } + return o.ReadOnly, true +} + +// HasReadOnly returns a boolean if a field has been set. +func (o *AuthToken) HasReadOnly() bool { + if o != nil && !IsNil(o.ReadOnly) { + return true + } + + return false +} + +// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field. +func (o *AuthToken) SetReadOnly(v bool) { + o.ReadOnly = &v +} + +// GetToken returns the Token field value if set, zero value otherwise. +func (o *AuthToken) GetToken() string { + if o == nil || IsNil(o.Token) { + var ret string + return ret + } + return *o.Token +} + +// GetTokenOk returns a tuple with the Token field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthToken) GetTokenOk() (*string, bool) { + if o == nil || IsNil(o.Token) { + return nil, false + } + return o.Token, true +} + +// HasToken returns a boolean if a field has been set. +func (o *AuthToken) HasToken() bool { + if o != nil && !IsNil(o.Token) { + return true + } + + return false +} + +// SetToken gets a reference to the given string and assigns it to the Token field. +func (o *AuthToken) SetToken(v string) { + o.Token = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *AuthToken) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthToken) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *AuthToken) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *AuthToken) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetUser returns the User field value if set, zero value otherwise. +func (o *AuthToken) GetUser() AuthTokenUser { + if o == nil || IsNil(o.User) { + var ret AuthTokenUser + return ret + } + return *o.User +} + +// GetUserOk returns a tuple with the User field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthToken) GetUserOk() (*AuthTokenUser, bool) { + if o == nil || IsNil(o.User) { + return nil, false + } + return o.User, true +} + +// HasUser returns a boolean if a field has been set. +func (o *AuthToken) HasUser() bool { + if o != nil && !IsNil(o.User) { + return true + } + + return false +} + +// SetUser gets a reference to the given AuthTokenUser and assigns it to the User field. +func (o *AuthToken) SetUser(v AuthTokenUser) { + o.User = &v +} + +func (o AuthToken) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AuthToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.ReadOnly) { + toSerialize["read_only"] = o.ReadOnly + } + if !IsNil(o.Token) { + toSerialize["token"] = o.Token + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.User) { + toSerialize["user"] = o.User + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AuthToken) UnmarshalJSON(data []byte) (err error) { + varAuthToken := _AuthToken{} + + err = json.Unmarshal(data, &varAuthToken) + + if err != nil { + return err + } + + *o = AuthToken(varAuthToken) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "project") + delete(additionalProperties, "read_only") + delete(additionalProperties, "token") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "user") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAuthToken struct { + value *AuthToken + isSet bool +} + +func (v NullableAuthToken) Get() *AuthToken { + return v.value +} + +func (v *NullableAuthToken) Set(val *AuthToken) { + v.value = val + v.isSet = true +} + +func (v NullableAuthToken) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthToken(val *AuthToken) *NullableAuthToken { + return &NullableAuthToken{value: val, isSet: true} +} + +func (v NullableAuthToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_input.go new file mode 100644 index 00000000..190c595b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_input.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the AuthTokenInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuthTokenInput{} + +// AuthTokenInput struct for AuthTokenInput +type AuthTokenInput struct { + Description *string `json:"description,omitempty"` + ReadOnly *bool `json:"read_only,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AuthTokenInput AuthTokenInput + +// NewAuthTokenInput instantiates a new AuthTokenInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAuthTokenInput() *AuthTokenInput { + this := AuthTokenInput{} + return &this +} + +// NewAuthTokenInputWithDefaults instantiates a new AuthTokenInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAuthTokenInputWithDefaults() *AuthTokenInput { + this := AuthTokenInput{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AuthTokenInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *AuthTokenInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AuthTokenInput) SetDescription(v string) { + o.Description = &v +} + +// GetReadOnly returns the ReadOnly field value if set, zero value otherwise. +func (o *AuthTokenInput) GetReadOnly() bool { + if o == nil || IsNil(o.ReadOnly) { + var ret bool + return ret + } + return *o.ReadOnly +} + +// GetReadOnlyOk returns a tuple with the ReadOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenInput) GetReadOnlyOk() (*bool, bool) { + if o == nil || IsNil(o.ReadOnly) { + return nil, false + } + return o.ReadOnly, true +} + +// HasReadOnly returns a boolean if a field has been set. +func (o *AuthTokenInput) HasReadOnly() bool { + if o != nil && !IsNil(o.ReadOnly) { + return true + } + + return false +} + +// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field. +func (o *AuthTokenInput) SetReadOnly(v bool) { + o.ReadOnly = &v +} + +func (o AuthTokenInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AuthTokenInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.ReadOnly) { + toSerialize["read_only"] = o.ReadOnly + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AuthTokenInput) UnmarshalJSON(data []byte) (err error) { + varAuthTokenInput := _AuthTokenInput{} + + err = json.Unmarshal(data, &varAuthTokenInput) + + if err != nil { + return err + } + + *o = AuthTokenInput(varAuthTokenInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "read_only") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAuthTokenInput struct { + value *AuthTokenInput + isSet bool +} + +func (v NullableAuthTokenInput) Get() *AuthTokenInput { + return v.value +} + +func (v *NullableAuthTokenInput) Set(val *AuthTokenInput) { + v.value = val + v.isSet = true +} + +func (v NullableAuthTokenInput) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthTokenInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthTokenInput(val *AuthTokenInput) *NullableAuthTokenInput { + return &NullableAuthTokenInput{value: val, isSet: true} +} + +func (v NullableAuthTokenInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthTokenInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_list.go new file mode 100644 index 00000000..a7152f71 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the AuthTokenList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuthTokenList{} + +// AuthTokenList struct for AuthTokenList +type AuthTokenList struct { + ApiKeys []AuthToken `json:"api_keys,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AuthTokenList AuthTokenList + +// NewAuthTokenList instantiates a new AuthTokenList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAuthTokenList() *AuthTokenList { + this := AuthTokenList{} + return &this +} + +// NewAuthTokenListWithDefaults instantiates a new AuthTokenList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAuthTokenListWithDefaults() *AuthTokenList { + this := AuthTokenList{} + return &this +} + +// GetApiKeys returns the ApiKeys field value if set, zero value otherwise. +func (o *AuthTokenList) GetApiKeys() []AuthToken { + if o == nil || IsNil(o.ApiKeys) { + var ret []AuthToken + return ret + } + return o.ApiKeys +} + +// GetApiKeysOk returns a tuple with the ApiKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenList) GetApiKeysOk() ([]AuthToken, bool) { + if o == nil || IsNil(o.ApiKeys) { + return nil, false + } + return o.ApiKeys, true +} + +// HasApiKeys returns a boolean if a field has been set. +func (o *AuthTokenList) HasApiKeys() bool { + if o != nil && !IsNil(o.ApiKeys) { + return true + } + + return false +} + +// SetApiKeys gets a reference to the given []AuthToken and assigns it to the ApiKeys field. +func (o *AuthTokenList) SetApiKeys(v []AuthToken) { + o.ApiKeys = v +} + +func (o AuthTokenList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AuthTokenList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ApiKeys) { + toSerialize["api_keys"] = o.ApiKeys + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AuthTokenList) UnmarshalJSON(data []byte) (err error) { + varAuthTokenList := _AuthTokenList{} + + err = json.Unmarshal(data, &varAuthTokenList) + + if err != nil { + return err + } + + *o = AuthTokenList(varAuthTokenList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "api_keys") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAuthTokenList struct { + value *AuthTokenList + isSet bool +} + +func (v NullableAuthTokenList) Get() *AuthTokenList { + return v.value +} + +func (v *NullableAuthTokenList) Set(val *AuthTokenList) { + v.value = val + v.isSet = true +} + +func (v NullableAuthTokenList) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthTokenList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthTokenList(val *AuthTokenList) *NullableAuthTokenList { + return &NullableAuthTokenList{value: val, isSet: true} +} + +func (v NullableAuthTokenList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthTokenList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_project.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_project.go new file mode 100644 index 00000000..f8184a7d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_project.go @@ -0,0 +1,822 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the AuthTokenProject type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuthTokenProject{} + +// AuthTokenProject struct for AuthTokenProject +type AuthTokenProject struct { + BgpConfig *Href `json:"bgp_config,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Devices []Href `json:"devices,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Invitations []Href `json:"invitations,omitempty"` + MaxDevices map[string]interface{} `json:"max_devices,omitempty"` + Members []Href `json:"members,omitempty"` + Memberships []Href `json:"memberships,omitempty"` + // The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis. + Name *string `json:"name,omitempty"` + NetworkStatus map[string]interface{} `json:"network_status,omitempty"` + Organization *Organization `json:"organization,omitempty"` + PaymentMethod *Href `json:"payment_method,omitempty"` + SshKeys []Href `json:"ssh_keys,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + Volumes []Href `json:"volumes,omitempty"` + Type *ProjectType `json:"type,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AuthTokenProject AuthTokenProject + +// NewAuthTokenProject instantiates a new AuthTokenProject object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAuthTokenProject() *AuthTokenProject { + this := AuthTokenProject{} + return &this +} + +// NewAuthTokenProjectWithDefaults instantiates a new AuthTokenProject object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAuthTokenProjectWithDefaults() *AuthTokenProject { + this := AuthTokenProject{} + return &this +} + +// GetBgpConfig returns the BgpConfig field value if set, zero value otherwise. +func (o *AuthTokenProject) GetBgpConfig() Href { + if o == nil || IsNil(o.BgpConfig) { + var ret Href + return ret + } + return *o.BgpConfig +} + +// GetBgpConfigOk returns a tuple with the BgpConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetBgpConfigOk() (*Href, bool) { + if o == nil || IsNil(o.BgpConfig) { + return nil, false + } + return o.BgpConfig, true +} + +// HasBgpConfig returns a boolean if a field has been set. +func (o *AuthTokenProject) HasBgpConfig() bool { + if o != nil && !IsNil(o.BgpConfig) { + return true + } + + return false +} + +// SetBgpConfig gets a reference to the given Href and assigns it to the BgpConfig field. +func (o *AuthTokenProject) SetBgpConfig(v Href) { + o.BgpConfig = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *AuthTokenProject) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *AuthTokenProject) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *AuthTokenProject) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *AuthTokenProject) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *AuthTokenProject) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *AuthTokenProject) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDevices returns the Devices field value if set, zero value otherwise. +func (o *AuthTokenProject) GetDevices() []Href { + if o == nil || IsNil(o.Devices) { + var ret []Href + return ret + } + return o.Devices +} + +// GetDevicesOk returns a tuple with the Devices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetDevicesOk() ([]Href, bool) { + if o == nil || IsNil(o.Devices) { + return nil, false + } + return o.Devices, true +} + +// HasDevices returns a boolean if a field has been set. +func (o *AuthTokenProject) HasDevices() bool { + if o != nil && !IsNil(o.Devices) { + return true + } + + return false +} + +// SetDevices gets a reference to the given []Href and assigns it to the Devices field. +func (o *AuthTokenProject) SetDevices(v []Href) { + o.Devices = v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *AuthTokenProject) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *AuthTokenProject) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *AuthTokenProject) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AuthTokenProject) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *AuthTokenProject) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AuthTokenProject) SetId(v string) { + o.Id = &v +} + +// GetInvitations returns the Invitations field value if set, zero value otherwise. +func (o *AuthTokenProject) GetInvitations() []Href { + if o == nil || IsNil(o.Invitations) { + var ret []Href + return ret + } + return o.Invitations +} + +// GetInvitationsOk returns a tuple with the Invitations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetInvitationsOk() ([]Href, bool) { + if o == nil || IsNil(o.Invitations) { + return nil, false + } + return o.Invitations, true +} + +// HasInvitations returns a boolean if a field has been set. +func (o *AuthTokenProject) HasInvitations() bool { + if o != nil && !IsNil(o.Invitations) { + return true + } + + return false +} + +// SetInvitations gets a reference to the given []Href and assigns it to the Invitations field. +func (o *AuthTokenProject) SetInvitations(v []Href) { + o.Invitations = v +} + +// GetMaxDevices returns the MaxDevices field value if set, zero value otherwise. +func (o *AuthTokenProject) GetMaxDevices() map[string]interface{} { + if o == nil || IsNil(o.MaxDevices) { + var ret map[string]interface{} + return ret + } + return o.MaxDevices +} + +// GetMaxDevicesOk returns a tuple with the MaxDevices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetMaxDevicesOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.MaxDevices) { + return map[string]interface{}{}, false + } + return o.MaxDevices, true +} + +// HasMaxDevices returns a boolean if a field has been set. +func (o *AuthTokenProject) HasMaxDevices() bool { + if o != nil && !IsNil(o.MaxDevices) { + return true + } + + return false +} + +// SetMaxDevices gets a reference to the given map[string]interface{} and assigns it to the MaxDevices field. +func (o *AuthTokenProject) SetMaxDevices(v map[string]interface{}) { + o.MaxDevices = v +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *AuthTokenProject) GetMembers() []Href { + if o == nil || IsNil(o.Members) { + var ret []Href + return ret + } + return o.Members +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetMembersOk() ([]Href, bool) { + if o == nil || IsNil(o.Members) { + return nil, false + } + return o.Members, true +} + +// HasMembers returns a boolean if a field has been set. +func (o *AuthTokenProject) HasMembers() bool { + if o != nil && !IsNil(o.Members) { + return true + } + + return false +} + +// SetMembers gets a reference to the given []Href and assigns it to the Members field. +func (o *AuthTokenProject) SetMembers(v []Href) { + o.Members = v +} + +// GetMemberships returns the Memberships field value if set, zero value otherwise. +func (o *AuthTokenProject) GetMemberships() []Href { + if o == nil || IsNil(o.Memberships) { + var ret []Href + return ret + } + return o.Memberships +} + +// GetMembershipsOk returns a tuple with the Memberships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetMembershipsOk() ([]Href, bool) { + if o == nil || IsNil(o.Memberships) { + return nil, false + } + return o.Memberships, true +} + +// HasMemberships returns a boolean if a field has been set. +func (o *AuthTokenProject) HasMemberships() bool { + if o != nil && !IsNil(o.Memberships) { + return true + } + + return false +} + +// SetMemberships gets a reference to the given []Href and assigns it to the Memberships field. +func (o *AuthTokenProject) SetMemberships(v []Href) { + o.Memberships = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *AuthTokenProject) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *AuthTokenProject) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *AuthTokenProject) SetName(v string) { + o.Name = &v +} + +// GetNetworkStatus returns the NetworkStatus field value if set, zero value otherwise. +func (o *AuthTokenProject) GetNetworkStatus() map[string]interface{} { + if o == nil || IsNil(o.NetworkStatus) { + var ret map[string]interface{} + return ret + } + return o.NetworkStatus +} + +// GetNetworkStatusOk returns a tuple with the NetworkStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetNetworkStatusOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.NetworkStatus) { + return map[string]interface{}{}, false + } + return o.NetworkStatus, true +} + +// HasNetworkStatus returns a boolean if a field has been set. +func (o *AuthTokenProject) HasNetworkStatus() bool { + if o != nil && !IsNil(o.NetworkStatus) { + return true + } + + return false +} + +// SetNetworkStatus gets a reference to the given map[string]interface{} and assigns it to the NetworkStatus field. +func (o *AuthTokenProject) SetNetworkStatus(v map[string]interface{}) { + o.NetworkStatus = v +} + +// GetOrganization returns the Organization field value if set, zero value otherwise. +func (o *AuthTokenProject) GetOrganization() Organization { + if o == nil || IsNil(o.Organization) { + var ret Organization + return ret + } + return *o.Organization +} + +// GetOrganizationOk returns a tuple with the Organization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetOrganizationOk() (*Organization, bool) { + if o == nil || IsNil(o.Organization) { + return nil, false + } + return o.Organization, true +} + +// HasOrganization returns a boolean if a field has been set. +func (o *AuthTokenProject) HasOrganization() bool { + if o != nil && !IsNil(o.Organization) { + return true + } + + return false +} + +// SetOrganization gets a reference to the given Organization and assigns it to the Organization field. +func (o *AuthTokenProject) SetOrganization(v Organization) { + o.Organization = &v +} + +// GetPaymentMethod returns the PaymentMethod field value if set, zero value otherwise. +func (o *AuthTokenProject) GetPaymentMethod() Href { + if o == nil || IsNil(o.PaymentMethod) { + var ret Href + return ret + } + return *o.PaymentMethod +} + +// GetPaymentMethodOk returns a tuple with the PaymentMethod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetPaymentMethodOk() (*Href, bool) { + if o == nil || IsNil(o.PaymentMethod) { + return nil, false + } + return o.PaymentMethod, true +} + +// HasPaymentMethod returns a boolean if a field has been set. +func (o *AuthTokenProject) HasPaymentMethod() bool { + if o != nil && !IsNil(o.PaymentMethod) { + return true + } + + return false +} + +// SetPaymentMethod gets a reference to the given Href and assigns it to the PaymentMethod field. +func (o *AuthTokenProject) SetPaymentMethod(v Href) { + o.PaymentMethod = &v +} + +// GetSshKeys returns the SshKeys field value if set, zero value otherwise. +func (o *AuthTokenProject) GetSshKeys() []Href { + if o == nil || IsNil(o.SshKeys) { + var ret []Href + return ret + } + return o.SshKeys +} + +// GetSshKeysOk returns a tuple with the SshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetSshKeysOk() ([]Href, bool) { + if o == nil || IsNil(o.SshKeys) { + return nil, false + } + return o.SshKeys, true +} + +// HasSshKeys returns a boolean if a field has been set. +func (o *AuthTokenProject) HasSshKeys() bool { + if o != nil && !IsNil(o.SshKeys) { + return true + } + + return false +} + +// SetSshKeys gets a reference to the given []Href and assigns it to the SshKeys field. +func (o *AuthTokenProject) SetSshKeys(v []Href) { + o.SshKeys = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *AuthTokenProject) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *AuthTokenProject) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *AuthTokenProject) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *AuthTokenProject) GetVolumes() []Href { + if o == nil || IsNil(o.Volumes) { + var ret []Href + return ret + } + return o.Volumes +} + +// GetVolumesOk returns a tuple with the Volumes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetVolumesOk() ([]Href, bool) { + if o == nil || IsNil(o.Volumes) { + return nil, false + } + return o.Volumes, true +} + +// HasVolumes returns a boolean if a field has been set. +func (o *AuthTokenProject) HasVolumes() bool { + if o != nil && !IsNil(o.Volumes) { + return true + } + + return false +} + +// SetVolumes gets a reference to the given []Href and assigns it to the Volumes field. +func (o *AuthTokenProject) SetVolumes(v []Href) { + o.Volumes = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *AuthTokenProject) GetType() ProjectType { + if o == nil || IsNil(o.Type) { + var ret ProjectType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetTypeOk() (*ProjectType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *AuthTokenProject) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given ProjectType and assigns it to the Type field. +func (o *AuthTokenProject) SetType(v ProjectType) { + o.Type = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *AuthTokenProject) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenProject) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *AuthTokenProject) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *AuthTokenProject) SetTags(v []string) { + o.Tags = v +} + +func (o AuthTokenProject) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AuthTokenProject) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BgpConfig) { + toSerialize["bgp_config"] = o.BgpConfig + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Devices) { + toSerialize["devices"] = o.Devices + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Invitations) { + toSerialize["invitations"] = o.Invitations + } + if !IsNil(o.MaxDevices) { + toSerialize["max_devices"] = o.MaxDevices + } + if !IsNil(o.Members) { + toSerialize["members"] = o.Members + } + if !IsNil(o.Memberships) { + toSerialize["memberships"] = o.Memberships + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.NetworkStatus) { + toSerialize["network_status"] = o.NetworkStatus + } + if !IsNil(o.Organization) { + toSerialize["organization"] = o.Organization + } + if !IsNil(o.PaymentMethod) { + toSerialize["payment_method"] = o.PaymentMethod + } + if !IsNil(o.SshKeys) { + toSerialize["ssh_keys"] = o.SshKeys + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Volumes) { + toSerialize["volumes"] = o.Volumes + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AuthTokenProject) UnmarshalJSON(data []byte) (err error) { + varAuthTokenProject := _AuthTokenProject{} + + err = json.Unmarshal(data, &varAuthTokenProject) + + if err != nil { + return err + } + + *o = AuthTokenProject(varAuthTokenProject) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bgp_config") + delete(additionalProperties, "created_at") + delete(additionalProperties, "customdata") + delete(additionalProperties, "devices") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "invitations") + delete(additionalProperties, "max_devices") + delete(additionalProperties, "members") + delete(additionalProperties, "memberships") + delete(additionalProperties, "name") + delete(additionalProperties, "network_status") + delete(additionalProperties, "organization") + delete(additionalProperties, "payment_method") + delete(additionalProperties, "ssh_keys") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "volumes") + delete(additionalProperties, "type") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAuthTokenProject struct { + value *AuthTokenProject + isSet bool +} + +func (v NullableAuthTokenProject) Get() *AuthTokenProject { + return v.value +} + +func (v *NullableAuthTokenProject) Set(val *AuthTokenProject) { + v.value = val + v.isSet = true +} + +func (v NullableAuthTokenProject) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthTokenProject) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthTokenProject(val *AuthTokenProject) *NullableAuthTokenProject { + return &NullableAuthTokenProject{value: val, isSet: true} +} + +func (v NullableAuthTokenProject) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthTokenProject) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_user.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_user.go new file mode 100644 index 00000000..f9211282 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_auth_token_user.go @@ -0,0 +1,932 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the AuthTokenUser type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuthTokenUser{} + +// AuthTokenUser struct for AuthTokenUser +type AuthTokenUser struct { + AvatarThumbUrl *string `json:"avatar_thumb_url,omitempty"` + AvatarUrl *string `json:"avatar_url,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + DefaultOrganizationId *string `json:"default_organization_id,omitempty"` + DefaultProjectId *string `json:"default_project_id,omitempty"` + Email *string `json:"email,omitempty"` + Emails []Href `json:"emails,omitempty"` + FirstName *string `json:"first_name,omitempty"` + FraudScore *string `json:"fraud_score,omitempty"` + FullName *string `json:"full_name,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + LastLoginAt *time.Time `json:"last_login_at,omitempty"` + LastName *string `json:"last_name,omitempty"` + MaxOrganizations *int32 `json:"max_organizations,omitempty"` + MaxProjects *int32 `json:"max_projects,omitempty"` + PhoneNumber *string `json:"phone_number,omitempty"` + ShortId *string `json:"short_id,omitempty"` + Timezone *string `json:"timezone,omitempty"` + TwoFactorAuth *string `json:"two_factor_auth,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AuthTokenUser AuthTokenUser + +// NewAuthTokenUser instantiates a new AuthTokenUser object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAuthTokenUser() *AuthTokenUser { + this := AuthTokenUser{} + return &this +} + +// NewAuthTokenUserWithDefaults instantiates a new AuthTokenUser object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAuthTokenUserWithDefaults() *AuthTokenUser { + this := AuthTokenUser{} + return &this +} + +// GetAvatarThumbUrl returns the AvatarThumbUrl field value if set, zero value otherwise. +func (o *AuthTokenUser) GetAvatarThumbUrl() string { + if o == nil || IsNil(o.AvatarThumbUrl) { + var ret string + return ret + } + return *o.AvatarThumbUrl +} + +// GetAvatarThumbUrlOk returns a tuple with the AvatarThumbUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetAvatarThumbUrlOk() (*string, bool) { + if o == nil || IsNil(o.AvatarThumbUrl) { + return nil, false + } + return o.AvatarThumbUrl, true +} + +// HasAvatarThumbUrl returns a boolean if a field has been set. +func (o *AuthTokenUser) HasAvatarThumbUrl() bool { + if o != nil && !IsNil(o.AvatarThumbUrl) { + return true + } + + return false +} + +// SetAvatarThumbUrl gets a reference to the given string and assigns it to the AvatarThumbUrl field. +func (o *AuthTokenUser) SetAvatarThumbUrl(v string) { + o.AvatarThumbUrl = &v +} + +// GetAvatarUrl returns the AvatarUrl field value if set, zero value otherwise. +func (o *AuthTokenUser) GetAvatarUrl() string { + if o == nil || IsNil(o.AvatarUrl) { + var ret string + return ret + } + return *o.AvatarUrl +} + +// GetAvatarUrlOk returns a tuple with the AvatarUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetAvatarUrlOk() (*string, bool) { + if o == nil || IsNil(o.AvatarUrl) { + return nil, false + } + return o.AvatarUrl, true +} + +// HasAvatarUrl returns a boolean if a field has been set. +func (o *AuthTokenUser) HasAvatarUrl() bool { + if o != nil && !IsNil(o.AvatarUrl) { + return true + } + + return false +} + +// SetAvatarUrl gets a reference to the given string and assigns it to the AvatarUrl field. +func (o *AuthTokenUser) SetAvatarUrl(v string) { + o.AvatarUrl = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *AuthTokenUser) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *AuthTokenUser) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *AuthTokenUser) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *AuthTokenUser) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *AuthTokenUser) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *AuthTokenUser) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDefaultOrganizationId returns the DefaultOrganizationId field value if set, zero value otherwise. +func (o *AuthTokenUser) GetDefaultOrganizationId() string { + if o == nil || IsNil(o.DefaultOrganizationId) { + var ret string + return ret + } + return *o.DefaultOrganizationId +} + +// GetDefaultOrganizationIdOk returns a tuple with the DefaultOrganizationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetDefaultOrganizationIdOk() (*string, bool) { + if o == nil || IsNil(o.DefaultOrganizationId) { + return nil, false + } + return o.DefaultOrganizationId, true +} + +// HasDefaultOrganizationId returns a boolean if a field has been set. +func (o *AuthTokenUser) HasDefaultOrganizationId() bool { + if o != nil && !IsNil(o.DefaultOrganizationId) { + return true + } + + return false +} + +// SetDefaultOrganizationId gets a reference to the given string and assigns it to the DefaultOrganizationId field. +func (o *AuthTokenUser) SetDefaultOrganizationId(v string) { + o.DefaultOrganizationId = &v +} + +// GetDefaultProjectId returns the DefaultProjectId field value if set, zero value otherwise. +func (o *AuthTokenUser) GetDefaultProjectId() string { + if o == nil || IsNil(o.DefaultProjectId) { + var ret string + return ret + } + return *o.DefaultProjectId +} + +// GetDefaultProjectIdOk returns a tuple with the DefaultProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetDefaultProjectIdOk() (*string, bool) { + if o == nil || IsNil(o.DefaultProjectId) { + return nil, false + } + return o.DefaultProjectId, true +} + +// HasDefaultProjectId returns a boolean if a field has been set. +func (o *AuthTokenUser) HasDefaultProjectId() bool { + if o != nil && !IsNil(o.DefaultProjectId) { + return true + } + + return false +} + +// SetDefaultProjectId gets a reference to the given string and assigns it to the DefaultProjectId field. +func (o *AuthTokenUser) SetDefaultProjectId(v string) { + o.DefaultProjectId = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *AuthTokenUser) GetEmail() string { + if o == nil || IsNil(o.Email) { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetEmailOk() (*string, bool) { + if o == nil || IsNil(o.Email) { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *AuthTokenUser) HasEmail() bool { + if o != nil && !IsNil(o.Email) { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *AuthTokenUser) SetEmail(v string) { + o.Email = &v +} + +// GetEmails returns the Emails field value if set, zero value otherwise. +func (o *AuthTokenUser) GetEmails() []Href { + if o == nil || IsNil(o.Emails) { + var ret []Href + return ret + } + return o.Emails +} + +// GetEmailsOk returns a tuple with the Emails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetEmailsOk() ([]Href, bool) { + if o == nil || IsNil(o.Emails) { + return nil, false + } + return o.Emails, true +} + +// HasEmails returns a boolean if a field has been set. +func (o *AuthTokenUser) HasEmails() bool { + if o != nil && !IsNil(o.Emails) { + return true + } + + return false +} + +// SetEmails gets a reference to the given []Href and assigns it to the Emails field. +func (o *AuthTokenUser) SetEmails(v []Href) { + o.Emails = v +} + +// GetFirstName returns the FirstName field value if set, zero value otherwise. +func (o *AuthTokenUser) GetFirstName() string { + if o == nil || IsNil(o.FirstName) { + var ret string + return ret + } + return *o.FirstName +} + +// GetFirstNameOk returns a tuple with the FirstName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetFirstNameOk() (*string, bool) { + if o == nil || IsNil(o.FirstName) { + return nil, false + } + return o.FirstName, true +} + +// HasFirstName returns a boolean if a field has been set. +func (o *AuthTokenUser) HasFirstName() bool { + if o != nil && !IsNil(o.FirstName) { + return true + } + + return false +} + +// SetFirstName gets a reference to the given string and assigns it to the FirstName field. +func (o *AuthTokenUser) SetFirstName(v string) { + o.FirstName = &v +} + +// GetFraudScore returns the FraudScore field value if set, zero value otherwise. +func (o *AuthTokenUser) GetFraudScore() string { + if o == nil || IsNil(o.FraudScore) { + var ret string + return ret + } + return *o.FraudScore +} + +// GetFraudScoreOk returns a tuple with the FraudScore field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetFraudScoreOk() (*string, bool) { + if o == nil || IsNil(o.FraudScore) { + return nil, false + } + return o.FraudScore, true +} + +// HasFraudScore returns a boolean if a field has been set. +func (o *AuthTokenUser) HasFraudScore() bool { + if o != nil && !IsNil(o.FraudScore) { + return true + } + + return false +} + +// SetFraudScore gets a reference to the given string and assigns it to the FraudScore field. +func (o *AuthTokenUser) SetFraudScore(v string) { + o.FraudScore = &v +} + +// GetFullName returns the FullName field value if set, zero value otherwise. +func (o *AuthTokenUser) GetFullName() string { + if o == nil || IsNil(o.FullName) { + var ret string + return ret + } + return *o.FullName +} + +// GetFullNameOk returns a tuple with the FullName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetFullNameOk() (*string, bool) { + if o == nil || IsNil(o.FullName) { + return nil, false + } + return o.FullName, true +} + +// HasFullName returns a boolean if a field has been set. +func (o *AuthTokenUser) HasFullName() bool { + if o != nil && !IsNil(o.FullName) { + return true + } + + return false +} + +// SetFullName gets a reference to the given string and assigns it to the FullName field. +func (o *AuthTokenUser) SetFullName(v string) { + o.FullName = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *AuthTokenUser) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *AuthTokenUser) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *AuthTokenUser) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AuthTokenUser) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *AuthTokenUser) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AuthTokenUser) SetId(v string) { + o.Id = &v +} + +// GetLastLoginAt returns the LastLoginAt field value if set, zero value otherwise. +func (o *AuthTokenUser) GetLastLoginAt() time.Time { + if o == nil || IsNil(o.LastLoginAt) { + var ret time.Time + return ret + } + return *o.LastLoginAt +} + +// GetLastLoginAtOk returns a tuple with the LastLoginAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetLastLoginAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.LastLoginAt) { + return nil, false + } + return o.LastLoginAt, true +} + +// HasLastLoginAt returns a boolean if a field has been set. +func (o *AuthTokenUser) HasLastLoginAt() bool { + if o != nil && !IsNil(o.LastLoginAt) { + return true + } + + return false +} + +// SetLastLoginAt gets a reference to the given time.Time and assigns it to the LastLoginAt field. +func (o *AuthTokenUser) SetLastLoginAt(v time.Time) { + o.LastLoginAt = &v +} + +// GetLastName returns the LastName field value if set, zero value otherwise. +func (o *AuthTokenUser) GetLastName() string { + if o == nil || IsNil(o.LastName) { + var ret string + return ret + } + return *o.LastName +} + +// GetLastNameOk returns a tuple with the LastName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetLastNameOk() (*string, bool) { + if o == nil || IsNil(o.LastName) { + return nil, false + } + return o.LastName, true +} + +// HasLastName returns a boolean if a field has been set. +func (o *AuthTokenUser) HasLastName() bool { + if o != nil && !IsNil(o.LastName) { + return true + } + + return false +} + +// SetLastName gets a reference to the given string and assigns it to the LastName field. +func (o *AuthTokenUser) SetLastName(v string) { + o.LastName = &v +} + +// GetMaxOrganizations returns the MaxOrganizations field value if set, zero value otherwise. +func (o *AuthTokenUser) GetMaxOrganizations() int32 { + if o == nil || IsNil(o.MaxOrganizations) { + var ret int32 + return ret + } + return *o.MaxOrganizations +} + +// GetMaxOrganizationsOk returns a tuple with the MaxOrganizations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetMaxOrganizationsOk() (*int32, bool) { + if o == nil || IsNil(o.MaxOrganizations) { + return nil, false + } + return o.MaxOrganizations, true +} + +// HasMaxOrganizations returns a boolean if a field has been set. +func (o *AuthTokenUser) HasMaxOrganizations() bool { + if o != nil && !IsNil(o.MaxOrganizations) { + return true + } + + return false +} + +// SetMaxOrganizations gets a reference to the given int32 and assigns it to the MaxOrganizations field. +func (o *AuthTokenUser) SetMaxOrganizations(v int32) { + o.MaxOrganizations = &v +} + +// GetMaxProjects returns the MaxProjects field value if set, zero value otherwise. +func (o *AuthTokenUser) GetMaxProjects() int32 { + if o == nil || IsNil(o.MaxProjects) { + var ret int32 + return ret + } + return *o.MaxProjects +} + +// GetMaxProjectsOk returns a tuple with the MaxProjects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetMaxProjectsOk() (*int32, bool) { + if o == nil || IsNil(o.MaxProjects) { + return nil, false + } + return o.MaxProjects, true +} + +// HasMaxProjects returns a boolean if a field has been set. +func (o *AuthTokenUser) HasMaxProjects() bool { + if o != nil && !IsNil(o.MaxProjects) { + return true + } + + return false +} + +// SetMaxProjects gets a reference to the given int32 and assigns it to the MaxProjects field. +func (o *AuthTokenUser) SetMaxProjects(v int32) { + o.MaxProjects = &v +} + +// GetPhoneNumber returns the PhoneNumber field value if set, zero value otherwise. +func (o *AuthTokenUser) GetPhoneNumber() string { + if o == nil || IsNil(o.PhoneNumber) { + var ret string + return ret + } + return *o.PhoneNumber +} + +// GetPhoneNumberOk returns a tuple with the PhoneNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetPhoneNumberOk() (*string, bool) { + if o == nil || IsNil(o.PhoneNumber) { + return nil, false + } + return o.PhoneNumber, true +} + +// HasPhoneNumber returns a boolean if a field has been set. +func (o *AuthTokenUser) HasPhoneNumber() bool { + if o != nil && !IsNil(o.PhoneNumber) { + return true + } + + return false +} + +// SetPhoneNumber gets a reference to the given string and assigns it to the PhoneNumber field. +func (o *AuthTokenUser) SetPhoneNumber(v string) { + o.PhoneNumber = &v +} + +// GetShortId returns the ShortId field value if set, zero value otherwise. +func (o *AuthTokenUser) GetShortId() string { + if o == nil || IsNil(o.ShortId) { + var ret string + return ret + } + return *o.ShortId +} + +// GetShortIdOk returns a tuple with the ShortId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetShortIdOk() (*string, bool) { + if o == nil || IsNil(o.ShortId) { + return nil, false + } + return o.ShortId, true +} + +// HasShortId returns a boolean if a field has been set. +func (o *AuthTokenUser) HasShortId() bool { + if o != nil && !IsNil(o.ShortId) { + return true + } + + return false +} + +// SetShortId gets a reference to the given string and assigns it to the ShortId field. +func (o *AuthTokenUser) SetShortId(v string) { + o.ShortId = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *AuthTokenUser) GetTimezone() string { + if o == nil || IsNil(o.Timezone) { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetTimezoneOk() (*string, bool) { + if o == nil || IsNil(o.Timezone) { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *AuthTokenUser) HasTimezone() bool { + if o != nil && !IsNil(o.Timezone) { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *AuthTokenUser) SetTimezone(v string) { + o.Timezone = &v +} + +// GetTwoFactorAuth returns the TwoFactorAuth field value if set, zero value otherwise. +func (o *AuthTokenUser) GetTwoFactorAuth() string { + if o == nil || IsNil(o.TwoFactorAuth) { + var ret string + return ret + } + return *o.TwoFactorAuth +} + +// GetTwoFactorAuthOk returns a tuple with the TwoFactorAuth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetTwoFactorAuthOk() (*string, bool) { + if o == nil || IsNil(o.TwoFactorAuth) { + return nil, false + } + return o.TwoFactorAuth, true +} + +// HasTwoFactorAuth returns a boolean if a field has been set. +func (o *AuthTokenUser) HasTwoFactorAuth() bool { + if o != nil && !IsNil(o.TwoFactorAuth) { + return true + } + + return false +} + +// SetTwoFactorAuth gets a reference to the given string and assigns it to the TwoFactorAuth field. +func (o *AuthTokenUser) SetTwoFactorAuth(v string) { + o.TwoFactorAuth = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *AuthTokenUser) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthTokenUser) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *AuthTokenUser) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *AuthTokenUser) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o AuthTokenUser) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AuthTokenUser) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AvatarThumbUrl) { + toSerialize["avatar_thumb_url"] = o.AvatarThumbUrl + } + if !IsNil(o.AvatarUrl) { + toSerialize["avatar_url"] = o.AvatarUrl + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.DefaultOrganizationId) { + toSerialize["default_organization_id"] = o.DefaultOrganizationId + } + if !IsNil(o.DefaultProjectId) { + toSerialize["default_project_id"] = o.DefaultProjectId + } + if !IsNil(o.Email) { + toSerialize["email"] = o.Email + } + if !IsNil(o.Emails) { + toSerialize["emails"] = o.Emails + } + if !IsNil(o.FirstName) { + toSerialize["first_name"] = o.FirstName + } + if !IsNil(o.FraudScore) { + toSerialize["fraud_score"] = o.FraudScore + } + if !IsNil(o.FullName) { + toSerialize["full_name"] = o.FullName + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.LastLoginAt) { + toSerialize["last_login_at"] = o.LastLoginAt + } + if !IsNil(o.LastName) { + toSerialize["last_name"] = o.LastName + } + if !IsNil(o.MaxOrganizations) { + toSerialize["max_organizations"] = o.MaxOrganizations + } + if !IsNil(o.MaxProjects) { + toSerialize["max_projects"] = o.MaxProjects + } + if !IsNil(o.PhoneNumber) { + toSerialize["phone_number"] = o.PhoneNumber + } + if !IsNil(o.ShortId) { + toSerialize["short_id"] = o.ShortId + } + if !IsNil(o.Timezone) { + toSerialize["timezone"] = o.Timezone + } + if !IsNil(o.TwoFactorAuth) { + toSerialize["two_factor_auth"] = o.TwoFactorAuth + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AuthTokenUser) UnmarshalJSON(data []byte) (err error) { + varAuthTokenUser := _AuthTokenUser{} + + err = json.Unmarshal(data, &varAuthTokenUser) + + if err != nil { + return err + } + + *o = AuthTokenUser(varAuthTokenUser) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "avatar_thumb_url") + delete(additionalProperties, "avatar_url") + delete(additionalProperties, "created_at") + delete(additionalProperties, "customdata") + delete(additionalProperties, "default_organization_id") + delete(additionalProperties, "default_project_id") + delete(additionalProperties, "email") + delete(additionalProperties, "emails") + delete(additionalProperties, "first_name") + delete(additionalProperties, "fraud_score") + delete(additionalProperties, "full_name") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "last_login_at") + delete(additionalProperties, "last_name") + delete(additionalProperties, "max_organizations") + delete(additionalProperties, "max_projects") + delete(additionalProperties, "phone_number") + delete(additionalProperties, "short_id") + delete(additionalProperties, "timezone") + delete(additionalProperties, "two_factor_auth") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAuthTokenUser struct { + value *AuthTokenUser + isSet bool +} + +func (v NullableAuthTokenUser) Get() *AuthTokenUser { + return v.value +} + +func (v *NullableAuthTokenUser) Set(val *AuthTokenUser) { + v.value = val + v.isSet = true +} + +func (v NullableAuthTokenUser) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthTokenUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthTokenUser(val *AuthTokenUser) *NullableAuthTokenUser { + return &NullableAuthTokenUser{value: val, isSet: true} +} + +func (v NullableAuthTokenUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthTokenUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_batch.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_batch.go new file mode 100644 index 00000000..baa8e8f9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_batch.go @@ -0,0 +1,414 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the Batch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Batch{} + +// Batch struct for Batch +type Batch struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + Devices []Href `json:"devices,omitempty"` + ErrorMessages []string `json:"error_messages,omitempty"` + Id *string `json:"id,omitempty"` + Project *Href `json:"project,omitempty"` + Quantity *int32 `json:"quantity,omitempty"` + State *string `json:"state,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Batch Batch + +// NewBatch instantiates a new Batch object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBatch() *Batch { + this := Batch{} + return &this +} + +// NewBatchWithDefaults instantiates a new Batch object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBatchWithDefaults() *Batch { + this := Batch{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Batch) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Batch) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Batch) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Batch) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDevices returns the Devices field value if set, zero value otherwise. +func (o *Batch) GetDevices() []Href { + if o == nil || IsNil(o.Devices) { + var ret []Href + return ret + } + return o.Devices +} + +// GetDevicesOk returns a tuple with the Devices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Batch) GetDevicesOk() ([]Href, bool) { + if o == nil || IsNil(o.Devices) { + return nil, false + } + return o.Devices, true +} + +// HasDevices returns a boolean if a field has been set. +func (o *Batch) HasDevices() bool { + if o != nil && !IsNil(o.Devices) { + return true + } + + return false +} + +// SetDevices gets a reference to the given []Href and assigns it to the Devices field. +func (o *Batch) SetDevices(v []Href) { + o.Devices = v +} + +// GetErrorMessages returns the ErrorMessages field value if set, zero value otherwise. +func (o *Batch) GetErrorMessages() []string { + if o == nil || IsNil(o.ErrorMessages) { + var ret []string + return ret + } + return o.ErrorMessages +} + +// GetErrorMessagesOk returns a tuple with the ErrorMessages field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Batch) GetErrorMessagesOk() ([]string, bool) { + if o == nil || IsNil(o.ErrorMessages) { + return nil, false + } + return o.ErrorMessages, true +} + +// HasErrorMessages returns a boolean if a field has been set. +func (o *Batch) HasErrorMessages() bool { + if o != nil && !IsNil(o.ErrorMessages) { + return true + } + + return false +} + +// SetErrorMessages gets a reference to the given []string and assigns it to the ErrorMessages field. +func (o *Batch) SetErrorMessages(v []string) { + o.ErrorMessages = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Batch) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Batch) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Batch) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Batch) SetId(v string) { + o.Id = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *Batch) GetProject() Href { + if o == nil || IsNil(o.Project) { + var ret Href + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Batch) GetProjectOk() (*Href, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *Batch) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Href and assigns it to the Project field. +func (o *Batch) SetProject(v Href) { + o.Project = &v +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *Batch) GetQuantity() int32 { + if o == nil || IsNil(o.Quantity) { + var ret int32 + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Batch) GetQuantityOk() (*int32, bool) { + if o == nil || IsNil(o.Quantity) { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *Batch) HasQuantity() bool { + if o != nil && !IsNil(o.Quantity) { + return true + } + + return false +} + +// SetQuantity gets a reference to the given int32 and assigns it to the Quantity field. +func (o *Batch) SetQuantity(v int32) { + o.Quantity = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Batch) GetState() string { + if o == nil || IsNil(o.State) { + var ret string + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Batch) GetStateOk() (*string, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Batch) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *Batch) SetState(v string) { + o.State = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Batch) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Batch) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Batch) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Batch) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o Batch) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Batch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Devices) { + toSerialize["devices"] = o.Devices + } + if !IsNil(o.ErrorMessages) { + toSerialize["error_messages"] = o.ErrorMessages + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.Quantity) { + toSerialize["quantity"] = o.Quantity + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Batch) UnmarshalJSON(data []byte) (err error) { + varBatch := _Batch{} + + err = json.Unmarshal(data, &varBatch) + + if err != nil { + return err + } + + *o = Batch(varBatch) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "devices") + delete(additionalProperties, "error_messages") + delete(additionalProperties, "id") + delete(additionalProperties, "project") + delete(additionalProperties, "quantity") + delete(additionalProperties, "state") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBatch struct { + value *Batch + isSet bool +} + +func (v NullableBatch) Get() *Batch { + return v.value +} + +func (v *NullableBatch) Set(val *Batch) { + v.value = val + v.isSet = true +} + +func (v NullableBatch) IsSet() bool { + return v.isSet +} + +func (v *NullableBatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBatch(val *Batch) *NullableBatch { + return &NullableBatch{value: val, isSet: true} +} + +func (v NullableBatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_batches_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_batches_list.go new file mode 100644 index 00000000..175ae864 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_batches_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the BatchesList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BatchesList{} + +// BatchesList struct for BatchesList +type BatchesList struct { + Batches []Batch `json:"batches,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BatchesList BatchesList + +// NewBatchesList instantiates a new BatchesList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBatchesList() *BatchesList { + this := BatchesList{} + return &this +} + +// NewBatchesListWithDefaults instantiates a new BatchesList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBatchesListWithDefaults() *BatchesList { + this := BatchesList{} + return &this +} + +// GetBatches returns the Batches field value if set, zero value otherwise. +func (o *BatchesList) GetBatches() []Batch { + if o == nil || IsNil(o.Batches) { + var ret []Batch + return ret + } + return o.Batches +} + +// GetBatchesOk returns a tuple with the Batches field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BatchesList) GetBatchesOk() ([]Batch, bool) { + if o == nil || IsNil(o.Batches) { + return nil, false + } + return o.Batches, true +} + +// HasBatches returns a boolean if a field has been set. +func (o *BatchesList) HasBatches() bool { + if o != nil && !IsNil(o.Batches) { + return true + } + + return false +} + +// SetBatches gets a reference to the given []Batch and assigns it to the Batches field. +func (o *BatchesList) SetBatches(v []Batch) { + o.Batches = v +} + +func (o BatchesList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BatchesList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Batches) { + toSerialize["batches"] = o.Batches + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BatchesList) UnmarshalJSON(data []byte) (err error) { + varBatchesList := _BatchesList{} + + err = json.Unmarshal(data, &varBatchesList) + + if err != nil { + return err + } + + *o = BatchesList(varBatchesList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "batches") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBatchesList struct { + value *BatchesList + isSet bool +} + +func (v NullableBatchesList) Get() *BatchesList { + return v.value +} + +func (v *NullableBatchesList) Set(val *BatchesList) { + v.value = val + v.isSet = true +} + +func (v NullableBatchesList) IsSet() bool { + return v.isSet +} + +func (v *NullableBatchesList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBatchesList(val *BatchesList) *NullableBatchesList { + return &NullableBatchesList{value: val, isSet: true} +} + +func (v NullableBatchesList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBatchesList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config.go new file mode 100644 index 00000000..e1db4750 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config.go @@ -0,0 +1,620 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the BgpConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BgpConfig{} + +// BgpConfig struct for BgpConfig +type BgpConfig struct { + // Autonomous System Number. ASN is required with Global BGP. With Local BGP the private ASN, 65000, is assigned. + Asn *int32 `json:"asn,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + DeploymentType *BgpConfigDeploymentType `json:"deployment_type,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + // The maximum number of route filters allowed per server + MaxPrefix *int32 `json:"max_prefix,omitempty"` + // (Optional) Password for BGP session in plaintext (not a checksum) + Md5 NullableString `json:"md5,omitempty"` + Project *Href `json:"project,omitempty"` + // The IP block ranges associated to the ASN (Populated in Global BGP only) + Ranges []GlobalBgpRange `json:"ranges,omitempty"` + RequestedAt *time.Time `json:"requested_at,omitempty"` + // Specifies AS-MACRO (aka AS-SET) to use when building client route filters + RouteObject *string `json:"route_object,omitempty"` + // The direct connections between neighboring routers that want to exchange routing information. + Sessions []BgpSession `json:"sessions,omitempty"` + Status *BgpConfigStatus `json:"status,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BgpConfig BgpConfig + +// NewBgpConfig instantiates a new BgpConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBgpConfig() *BgpConfig { + this := BgpConfig{} + var maxPrefix int32 = 10 + this.MaxPrefix = &maxPrefix + return &this +} + +// NewBgpConfigWithDefaults instantiates a new BgpConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBgpConfigWithDefaults() *BgpConfig { + this := BgpConfig{} + var maxPrefix int32 = 10 + this.MaxPrefix = &maxPrefix + return &this +} + +// GetAsn returns the Asn field value if set, zero value otherwise. +func (o *BgpConfig) GetAsn() int32 { + if o == nil || IsNil(o.Asn) { + var ret int32 + return ret + } + return *o.Asn +} + +// GetAsnOk returns a tuple with the Asn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetAsnOk() (*int32, bool) { + if o == nil || IsNil(o.Asn) { + return nil, false + } + return o.Asn, true +} + +// HasAsn returns a boolean if a field has been set. +func (o *BgpConfig) HasAsn() bool { + if o != nil && !IsNil(o.Asn) { + return true + } + + return false +} + +// SetAsn gets a reference to the given int32 and assigns it to the Asn field. +func (o *BgpConfig) SetAsn(v int32) { + o.Asn = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *BgpConfig) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *BgpConfig) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *BgpConfig) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDeploymentType returns the DeploymentType field value if set, zero value otherwise. +func (o *BgpConfig) GetDeploymentType() BgpConfigDeploymentType { + if o == nil || IsNil(o.DeploymentType) { + var ret BgpConfigDeploymentType + return ret + } + return *o.DeploymentType +} + +// GetDeploymentTypeOk returns a tuple with the DeploymentType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetDeploymentTypeOk() (*BgpConfigDeploymentType, bool) { + if o == nil || IsNil(o.DeploymentType) { + return nil, false + } + return o.DeploymentType, true +} + +// HasDeploymentType returns a boolean if a field has been set. +func (o *BgpConfig) HasDeploymentType() bool { + if o != nil && !IsNil(o.DeploymentType) { + return true + } + + return false +} + +// SetDeploymentType gets a reference to the given BgpConfigDeploymentType and assigns it to the DeploymentType field. +func (o *BgpConfig) SetDeploymentType(v BgpConfigDeploymentType) { + o.DeploymentType = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *BgpConfig) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *BgpConfig) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *BgpConfig) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BgpConfig) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BgpConfig) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BgpConfig) SetId(v string) { + o.Id = &v +} + +// GetMaxPrefix returns the MaxPrefix field value if set, zero value otherwise. +func (o *BgpConfig) GetMaxPrefix() int32 { + if o == nil || IsNil(o.MaxPrefix) { + var ret int32 + return ret + } + return *o.MaxPrefix +} + +// GetMaxPrefixOk returns a tuple with the MaxPrefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetMaxPrefixOk() (*int32, bool) { + if o == nil || IsNil(o.MaxPrefix) { + return nil, false + } + return o.MaxPrefix, true +} + +// HasMaxPrefix returns a boolean if a field has been set. +func (o *BgpConfig) HasMaxPrefix() bool { + if o != nil && !IsNil(o.MaxPrefix) { + return true + } + + return false +} + +// SetMaxPrefix gets a reference to the given int32 and assigns it to the MaxPrefix field. +func (o *BgpConfig) SetMaxPrefix(v int32) { + o.MaxPrefix = &v +} + +// GetMd5 returns the Md5 field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *BgpConfig) GetMd5() string { + if o == nil || IsNil(o.Md5.Get()) { + var ret string + return ret + } + return *o.Md5.Get() +} + +// GetMd5Ok returns a tuple with the Md5 field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BgpConfig) GetMd5Ok() (*string, bool) { + if o == nil { + return nil, false + } + return o.Md5.Get(), o.Md5.IsSet() +} + +// HasMd5 returns a boolean if a field has been set. +func (o *BgpConfig) HasMd5() bool { + if o != nil && o.Md5.IsSet() { + return true + } + + return false +} + +// SetMd5 gets a reference to the given NullableString and assigns it to the Md5 field. +func (o *BgpConfig) SetMd5(v string) { + o.Md5.Set(&v) +} + +// SetMd5Nil sets the value for Md5 to be an explicit nil +func (o *BgpConfig) SetMd5Nil() { + o.Md5.Set(nil) +} + +// UnsetMd5 ensures that no value is present for Md5, not even an explicit nil +func (o *BgpConfig) UnsetMd5() { + o.Md5.Unset() +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *BgpConfig) GetProject() Href { + if o == nil || IsNil(o.Project) { + var ret Href + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetProjectOk() (*Href, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *BgpConfig) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Href and assigns it to the Project field. +func (o *BgpConfig) SetProject(v Href) { + o.Project = &v +} + +// GetRanges returns the Ranges field value if set, zero value otherwise. +func (o *BgpConfig) GetRanges() []GlobalBgpRange { + if o == nil || IsNil(o.Ranges) { + var ret []GlobalBgpRange + return ret + } + return o.Ranges +} + +// GetRangesOk returns a tuple with the Ranges field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetRangesOk() ([]GlobalBgpRange, bool) { + if o == nil || IsNil(o.Ranges) { + return nil, false + } + return o.Ranges, true +} + +// HasRanges returns a boolean if a field has been set. +func (o *BgpConfig) HasRanges() bool { + if o != nil && !IsNil(o.Ranges) { + return true + } + + return false +} + +// SetRanges gets a reference to the given []GlobalBgpRange and assigns it to the Ranges field. +func (o *BgpConfig) SetRanges(v []GlobalBgpRange) { + o.Ranges = v +} + +// GetRequestedAt returns the RequestedAt field value if set, zero value otherwise. +func (o *BgpConfig) GetRequestedAt() time.Time { + if o == nil || IsNil(o.RequestedAt) { + var ret time.Time + return ret + } + return *o.RequestedAt +} + +// GetRequestedAtOk returns a tuple with the RequestedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetRequestedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.RequestedAt) { + return nil, false + } + return o.RequestedAt, true +} + +// HasRequestedAt returns a boolean if a field has been set. +func (o *BgpConfig) HasRequestedAt() bool { + if o != nil && !IsNil(o.RequestedAt) { + return true + } + + return false +} + +// SetRequestedAt gets a reference to the given time.Time and assigns it to the RequestedAt field. +func (o *BgpConfig) SetRequestedAt(v time.Time) { + o.RequestedAt = &v +} + +// GetRouteObject returns the RouteObject field value if set, zero value otherwise. +func (o *BgpConfig) GetRouteObject() string { + if o == nil || IsNil(o.RouteObject) { + var ret string + return ret + } + return *o.RouteObject +} + +// GetRouteObjectOk returns a tuple with the RouteObject field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetRouteObjectOk() (*string, bool) { + if o == nil || IsNil(o.RouteObject) { + return nil, false + } + return o.RouteObject, true +} + +// HasRouteObject returns a boolean if a field has been set. +func (o *BgpConfig) HasRouteObject() bool { + if o != nil && !IsNil(o.RouteObject) { + return true + } + + return false +} + +// SetRouteObject gets a reference to the given string and assigns it to the RouteObject field. +func (o *BgpConfig) SetRouteObject(v string) { + o.RouteObject = &v +} + +// GetSessions returns the Sessions field value if set, zero value otherwise. +func (o *BgpConfig) GetSessions() []BgpSession { + if o == nil || IsNil(o.Sessions) { + var ret []BgpSession + return ret + } + return o.Sessions +} + +// GetSessionsOk returns a tuple with the Sessions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetSessionsOk() ([]BgpSession, bool) { + if o == nil || IsNil(o.Sessions) { + return nil, false + } + return o.Sessions, true +} + +// HasSessions returns a boolean if a field has been set. +func (o *BgpConfig) HasSessions() bool { + if o != nil && !IsNil(o.Sessions) { + return true + } + + return false +} + +// SetSessions gets a reference to the given []BgpSession and assigns it to the Sessions field. +func (o *BgpConfig) SetSessions(v []BgpSession) { + o.Sessions = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *BgpConfig) GetStatus() BgpConfigStatus { + if o == nil || IsNil(o.Status) { + var ret BgpConfigStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfig) GetStatusOk() (*BgpConfigStatus, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *BgpConfig) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given BgpConfigStatus and assigns it to the Status field. +func (o *BgpConfig) SetStatus(v BgpConfigStatus) { + o.Status = &v +} + +func (o BgpConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BgpConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Asn) { + toSerialize["asn"] = o.Asn + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.DeploymentType) { + toSerialize["deployment_type"] = o.DeploymentType + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.MaxPrefix) { + toSerialize["max_prefix"] = o.MaxPrefix + } + if o.Md5.IsSet() { + toSerialize["md5"] = o.Md5.Get() + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.Ranges) { + toSerialize["ranges"] = o.Ranges + } + if !IsNil(o.RequestedAt) { + toSerialize["requested_at"] = o.RequestedAt + } + if !IsNil(o.RouteObject) { + toSerialize["route_object"] = o.RouteObject + } + if !IsNil(o.Sessions) { + toSerialize["sessions"] = o.Sessions + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BgpConfig) UnmarshalJSON(data []byte) (err error) { + varBgpConfig := _BgpConfig{} + + err = json.Unmarshal(data, &varBgpConfig) + + if err != nil { + return err + } + + *o = BgpConfig(varBgpConfig) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "asn") + delete(additionalProperties, "created_at") + delete(additionalProperties, "deployment_type") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "max_prefix") + delete(additionalProperties, "md5") + delete(additionalProperties, "project") + delete(additionalProperties, "ranges") + delete(additionalProperties, "requested_at") + delete(additionalProperties, "route_object") + delete(additionalProperties, "sessions") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBgpConfig struct { + value *BgpConfig + isSet bool +} + +func (v NullableBgpConfig) Get() *BgpConfig { + return v.value +} + +func (v *NullableBgpConfig) Set(val *BgpConfig) { + v.value = val + v.isSet = true +} + +func (v NullableBgpConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpConfig(val *BgpConfig) *NullableBgpConfig { + return &NullableBgpConfig{value: val, isSet: true} +} + +func (v NullableBgpConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_deployment_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_deployment_type.go new file mode 100644 index 00000000..5104eec7 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_deployment_type.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// BgpConfigDeploymentType In a Local BGP deployment, a customer uses an internal ASN to control routes within a single Equinix Metal datacenter. This means that the routes are never advertised to the global Internet. Global BGP, on the other hand, requires a customer to have a registered ASN and IP space. +type BgpConfigDeploymentType string + +// List of BgpConfig_deployment_type +const ( + BGPCONFIGDEPLOYMENTTYPE_GLOBAL BgpConfigDeploymentType = "global" + BGPCONFIGDEPLOYMENTTYPE_LOCAL BgpConfigDeploymentType = "local" +) + +// All allowed values of BgpConfigDeploymentType enum +var AllowedBgpConfigDeploymentTypeEnumValues = []BgpConfigDeploymentType{ + "global", + "local", +} + +func (v *BgpConfigDeploymentType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := BgpConfigDeploymentType(value) + for _, existing := range AllowedBgpConfigDeploymentTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid BgpConfigDeploymentType", value) +} + +// NewBgpConfigDeploymentTypeFromValue returns a pointer to a valid BgpConfigDeploymentType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewBgpConfigDeploymentTypeFromValue(v string) (*BgpConfigDeploymentType, error) { + ev := BgpConfigDeploymentType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for BgpConfigDeploymentType: valid values are %v", v, AllowedBgpConfigDeploymentTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v BgpConfigDeploymentType) IsValid() bool { + for _, existing := range AllowedBgpConfigDeploymentTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to BgpConfig_deployment_type value +func (v BgpConfigDeploymentType) Ptr() *BgpConfigDeploymentType { + return &v +} + +type NullableBgpConfigDeploymentType struct { + value *BgpConfigDeploymentType + isSet bool +} + +func (v NullableBgpConfigDeploymentType) Get() *BgpConfigDeploymentType { + return v.value +} + +func (v *NullableBgpConfigDeploymentType) Set(val *BgpConfigDeploymentType) { + v.value = val + v.isSet = true +} + +func (v NullableBgpConfigDeploymentType) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpConfigDeploymentType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpConfigDeploymentType(val *BgpConfigDeploymentType) *NullableBgpConfigDeploymentType { + return &NullableBgpConfigDeploymentType{value: val, isSet: true} +} + +func (v NullableBgpConfigDeploymentType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpConfigDeploymentType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_request_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_request_input.go new file mode 100644 index 00000000..296d6de1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_request_input.go @@ -0,0 +1,273 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the BgpConfigRequestInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BgpConfigRequestInput{} + +// BgpConfigRequestInput struct for BgpConfigRequestInput +type BgpConfigRequestInput struct { + // Autonomous System Number for local BGP deployment. + Asn int32 `json:"asn"` + DeploymentType BgpConfigRequestInputDeploymentType `json:"deployment_type"` + // The plaintext password to share between BGP neighbors as an MD5 checksum: * must be 10-20 characters long * may not include punctuation * must be a combination of numbers and letters * must contain at least one lowercase, uppercase, and digit character + Md5 *string `json:"md5,omitempty"` + // A use case explanation (necessary for global BGP request review). + UseCase *string `json:"use_case,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BgpConfigRequestInput BgpConfigRequestInput + +// NewBgpConfigRequestInput instantiates a new BgpConfigRequestInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBgpConfigRequestInput(asn int32, deploymentType BgpConfigRequestInputDeploymentType) *BgpConfigRequestInput { + this := BgpConfigRequestInput{} + this.Asn = asn + this.DeploymentType = deploymentType + return &this +} + +// NewBgpConfigRequestInputWithDefaults instantiates a new BgpConfigRequestInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBgpConfigRequestInputWithDefaults() *BgpConfigRequestInput { + this := BgpConfigRequestInput{} + return &this +} + +// GetAsn returns the Asn field value +func (o *BgpConfigRequestInput) GetAsn() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Asn +} + +// GetAsnOk returns a tuple with the Asn field value +// and a boolean to check if the value has been set. +func (o *BgpConfigRequestInput) GetAsnOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Asn, true +} + +// SetAsn sets field value +func (o *BgpConfigRequestInput) SetAsn(v int32) { + o.Asn = v +} + +// GetDeploymentType returns the DeploymentType field value +func (o *BgpConfigRequestInput) GetDeploymentType() BgpConfigRequestInputDeploymentType { + if o == nil { + var ret BgpConfigRequestInputDeploymentType + return ret + } + + return o.DeploymentType +} + +// GetDeploymentTypeOk returns a tuple with the DeploymentType field value +// and a boolean to check if the value has been set. +func (o *BgpConfigRequestInput) GetDeploymentTypeOk() (*BgpConfigRequestInputDeploymentType, bool) { + if o == nil { + return nil, false + } + return &o.DeploymentType, true +} + +// SetDeploymentType sets field value +func (o *BgpConfigRequestInput) SetDeploymentType(v BgpConfigRequestInputDeploymentType) { + o.DeploymentType = v +} + +// GetMd5 returns the Md5 field value if set, zero value otherwise. +func (o *BgpConfigRequestInput) GetMd5() string { + if o == nil || IsNil(o.Md5) { + var ret string + return ret + } + return *o.Md5 +} + +// GetMd5Ok returns a tuple with the Md5 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfigRequestInput) GetMd5Ok() (*string, bool) { + if o == nil || IsNil(o.Md5) { + return nil, false + } + return o.Md5, true +} + +// HasMd5 returns a boolean if a field has been set. +func (o *BgpConfigRequestInput) HasMd5() bool { + if o != nil && !IsNil(o.Md5) { + return true + } + + return false +} + +// SetMd5 gets a reference to the given string and assigns it to the Md5 field. +func (o *BgpConfigRequestInput) SetMd5(v string) { + o.Md5 = &v +} + +// GetUseCase returns the UseCase field value if set, zero value otherwise. +func (o *BgpConfigRequestInput) GetUseCase() string { + if o == nil || IsNil(o.UseCase) { + var ret string + return ret + } + return *o.UseCase +} + +// GetUseCaseOk returns a tuple with the UseCase field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpConfigRequestInput) GetUseCaseOk() (*string, bool) { + if o == nil || IsNil(o.UseCase) { + return nil, false + } + return o.UseCase, true +} + +// HasUseCase returns a boolean if a field has been set. +func (o *BgpConfigRequestInput) HasUseCase() bool { + if o != nil && !IsNil(o.UseCase) { + return true + } + + return false +} + +// SetUseCase gets a reference to the given string and assigns it to the UseCase field. +func (o *BgpConfigRequestInput) SetUseCase(v string) { + o.UseCase = &v +} + +func (o BgpConfigRequestInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BgpConfigRequestInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["asn"] = o.Asn + toSerialize["deployment_type"] = o.DeploymentType + if !IsNil(o.Md5) { + toSerialize["md5"] = o.Md5 + } + if !IsNil(o.UseCase) { + toSerialize["use_case"] = o.UseCase + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BgpConfigRequestInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "asn", + "deployment_type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varBgpConfigRequestInput := _BgpConfigRequestInput{} + + err = json.Unmarshal(data, &varBgpConfigRequestInput) + + if err != nil { + return err + } + + *o = BgpConfigRequestInput(varBgpConfigRequestInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "asn") + delete(additionalProperties, "deployment_type") + delete(additionalProperties, "md5") + delete(additionalProperties, "use_case") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBgpConfigRequestInput struct { + value *BgpConfigRequestInput + isSet bool +} + +func (v NullableBgpConfigRequestInput) Get() *BgpConfigRequestInput { + return v.value +} + +func (v *NullableBgpConfigRequestInput) Set(val *BgpConfigRequestInput) { + v.value = val + v.isSet = true +} + +func (v NullableBgpConfigRequestInput) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpConfigRequestInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpConfigRequestInput(val *BgpConfigRequestInput) *NullableBgpConfigRequestInput { + return &NullableBgpConfigRequestInput{value: val, isSet: true} +} + +func (v NullableBgpConfigRequestInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpConfigRequestInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_request_input_deployment_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_request_input_deployment_type.go new file mode 100644 index 00000000..e9565961 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_request_input_deployment_type.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// BgpConfigRequestInputDeploymentType Wether the BGP deployment is local or global. Local deployments are configured immediately. Global deployments will need to be reviewed by Equinix Metal engineers. +type BgpConfigRequestInputDeploymentType string + +// List of BgpConfigRequestInput_deployment_type +const ( + BGPCONFIGREQUESTINPUTDEPLOYMENTTYPE_LOCAL BgpConfigRequestInputDeploymentType = "local" + BGPCONFIGREQUESTINPUTDEPLOYMENTTYPE_GLOBAL BgpConfigRequestInputDeploymentType = "global" +) + +// All allowed values of BgpConfigRequestInputDeploymentType enum +var AllowedBgpConfigRequestInputDeploymentTypeEnumValues = []BgpConfigRequestInputDeploymentType{ + "local", + "global", +} + +func (v *BgpConfigRequestInputDeploymentType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := BgpConfigRequestInputDeploymentType(value) + for _, existing := range AllowedBgpConfigRequestInputDeploymentTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid BgpConfigRequestInputDeploymentType", value) +} + +// NewBgpConfigRequestInputDeploymentTypeFromValue returns a pointer to a valid BgpConfigRequestInputDeploymentType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewBgpConfigRequestInputDeploymentTypeFromValue(v string) (*BgpConfigRequestInputDeploymentType, error) { + ev := BgpConfigRequestInputDeploymentType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for BgpConfigRequestInputDeploymentType: valid values are %v", v, AllowedBgpConfigRequestInputDeploymentTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v BgpConfigRequestInputDeploymentType) IsValid() bool { + for _, existing := range AllowedBgpConfigRequestInputDeploymentTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to BgpConfigRequestInput_deployment_type value +func (v BgpConfigRequestInputDeploymentType) Ptr() *BgpConfigRequestInputDeploymentType { + return &v +} + +type NullableBgpConfigRequestInputDeploymentType struct { + value *BgpConfigRequestInputDeploymentType + isSet bool +} + +func (v NullableBgpConfigRequestInputDeploymentType) Get() *BgpConfigRequestInputDeploymentType { + return v.value +} + +func (v *NullableBgpConfigRequestInputDeploymentType) Set(val *BgpConfigRequestInputDeploymentType) { + v.value = val + v.isSet = true +} + +func (v NullableBgpConfigRequestInputDeploymentType) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpConfigRequestInputDeploymentType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpConfigRequestInputDeploymentType(val *BgpConfigRequestInputDeploymentType) *NullableBgpConfigRequestInputDeploymentType { + return &NullableBgpConfigRequestInputDeploymentType{value: val, isSet: true} +} + +func (v NullableBgpConfigRequestInputDeploymentType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpConfigRequestInputDeploymentType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_status.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_status.go new file mode 100644 index 00000000..878e723c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_config_status.go @@ -0,0 +1,113 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// BgpConfigStatus Status of the BGP Config. Status \"requested\" is valid only with the \"global\" deployment_type. +type BgpConfigStatus string + +// List of BgpConfig_status +const ( + BGPCONFIGSTATUS_REQUESTED BgpConfigStatus = "requested" + BGPCONFIGSTATUS_ENABLED BgpConfigStatus = "enabled" + BGPCONFIGSTATUS_DISABLED BgpConfigStatus = "disabled" +) + +// All allowed values of BgpConfigStatus enum +var AllowedBgpConfigStatusEnumValues = []BgpConfigStatus{ + "requested", + "enabled", + "disabled", +} + +func (v *BgpConfigStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := BgpConfigStatus(value) + for _, existing := range AllowedBgpConfigStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid BgpConfigStatus", value) +} + +// NewBgpConfigStatusFromValue returns a pointer to a valid BgpConfigStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewBgpConfigStatusFromValue(v string) (*BgpConfigStatus, error) { + ev := BgpConfigStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for BgpConfigStatus: valid values are %v", v, AllowedBgpConfigStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v BgpConfigStatus) IsValid() bool { + for _, existing := range AllowedBgpConfigStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to BgpConfig_status value +func (v BgpConfigStatus) Ptr() *BgpConfigStatus { + return &v +} + +type NullableBgpConfigStatus struct { + value *BgpConfigStatus + isSet bool +} + +func (v NullableBgpConfigStatus) Get() *BgpConfigStatus { + return v.value +} + +func (v *NullableBgpConfigStatus) Set(val *BgpConfigStatus) { + v.value = val + v.isSet = true +} + +func (v NullableBgpConfigStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpConfigStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpConfigStatus(val *BgpConfigStatus) *NullableBgpConfigStatus { + return &NullableBgpConfigStatus{value: val, isSet: true} +} + +func (v NullableBgpConfigStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpConfigStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor.go new file mode 100644 index 00000000..c4241d7e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor.go @@ -0,0 +1,491 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the BgpDynamicNeighbor type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BgpDynamicNeighbor{} + +// BgpDynamicNeighbor struct for BgpDynamicNeighbor +type BgpDynamicNeighbor struct { + // The unique identifier for the resource + Id *string `json:"id,omitempty"` + // The ASN of the dynamic BGP neighbor + BgpNeighborAsn *int32 `json:"bgp_neighbor_asn,omitempty"` + // Network range of the dynamic BGP neighbor in CIDR format + BgpNeighborRange *string `json:"bgp_neighbor_range,omitempty"` + MetalGateway *VrfMetalGateway `json:"metal_gateway,omitempty"` + State *BgpDynamicNeighborState `json:"state,omitempty"` + Href *string `json:"href,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + CreatedBy *UserLimited `json:"created_by,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BgpDynamicNeighbor BgpDynamicNeighbor + +// NewBgpDynamicNeighbor instantiates a new BgpDynamicNeighbor object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBgpDynamicNeighbor() *BgpDynamicNeighbor { + this := BgpDynamicNeighbor{} + return &this +} + +// NewBgpDynamicNeighborWithDefaults instantiates a new BgpDynamicNeighbor object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBgpDynamicNeighborWithDefaults() *BgpDynamicNeighbor { + this := BgpDynamicNeighbor{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BgpDynamicNeighbor) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighbor) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BgpDynamicNeighbor) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BgpDynamicNeighbor) SetId(v string) { + o.Id = &v +} + +// GetBgpNeighborAsn returns the BgpNeighborAsn field value if set, zero value otherwise. +func (o *BgpDynamicNeighbor) GetBgpNeighborAsn() int32 { + if o == nil || IsNil(o.BgpNeighborAsn) { + var ret int32 + return ret + } + return *o.BgpNeighborAsn +} + +// GetBgpNeighborAsnOk returns a tuple with the BgpNeighborAsn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighbor) GetBgpNeighborAsnOk() (*int32, bool) { + if o == nil || IsNil(o.BgpNeighborAsn) { + return nil, false + } + return o.BgpNeighborAsn, true +} + +// HasBgpNeighborAsn returns a boolean if a field has been set. +func (o *BgpDynamicNeighbor) HasBgpNeighborAsn() bool { + if o != nil && !IsNil(o.BgpNeighborAsn) { + return true + } + + return false +} + +// SetBgpNeighborAsn gets a reference to the given int32 and assigns it to the BgpNeighborAsn field. +func (o *BgpDynamicNeighbor) SetBgpNeighborAsn(v int32) { + o.BgpNeighborAsn = &v +} + +// GetBgpNeighborRange returns the BgpNeighborRange field value if set, zero value otherwise. +func (o *BgpDynamicNeighbor) GetBgpNeighborRange() string { + if o == nil || IsNil(o.BgpNeighborRange) { + var ret string + return ret + } + return *o.BgpNeighborRange +} + +// GetBgpNeighborRangeOk returns a tuple with the BgpNeighborRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighbor) GetBgpNeighborRangeOk() (*string, bool) { + if o == nil || IsNil(o.BgpNeighborRange) { + return nil, false + } + return o.BgpNeighborRange, true +} + +// HasBgpNeighborRange returns a boolean if a field has been set. +func (o *BgpDynamicNeighbor) HasBgpNeighborRange() bool { + if o != nil && !IsNil(o.BgpNeighborRange) { + return true + } + + return false +} + +// SetBgpNeighborRange gets a reference to the given string and assigns it to the BgpNeighborRange field. +func (o *BgpDynamicNeighbor) SetBgpNeighborRange(v string) { + o.BgpNeighborRange = &v +} + +// GetMetalGateway returns the MetalGateway field value if set, zero value otherwise. +func (o *BgpDynamicNeighbor) GetMetalGateway() VrfMetalGateway { + if o == nil || IsNil(o.MetalGateway) { + var ret VrfMetalGateway + return ret + } + return *o.MetalGateway +} + +// GetMetalGatewayOk returns a tuple with the MetalGateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighbor) GetMetalGatewayOk() (*VrfMetalGateway, bool) { + if o == nil || IsNil(o.MetalGateway) { + return nil, false + } + return o.MetalGateway, true +} + +// HasMetalGateway returns a boolean if a field has been set. +func (o *BgpDynamicNeighbor) HasMetalGateway() bool { + if o != nil && !IsNil(o.MetalGateway) { + return true + } + + return false +} + +// SetMetalGateway gets a reference to the given VrfMetalGateway and assigns it to the MetalGateway field. +func (o *BgpDynamicNeighbor) SetMetalGateway(v VrfMetalGateway) { + o.MetalGateway = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *BgpDynamicNeighbor) GetState() BgpDynamicNeighborState { + if o == nil || IsNil(o.State) { + var ret BgpDynamicNeighborState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighbor) GetStateOk() (*BgpDynamicNeighborState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *BgpDynamicNeighbor) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given BgpDynamicNeighborState and assigns it to the State field. +func (o *BgpDynamicNeighbor) SetState(v BgpDynamicNeighborState) { + o.State = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *BgpDynamicNeighbor) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighbor) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *BgpDynamicNeighbor) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *BgpDynamicNeighbor) SetHref(v string) { + o.Href = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *BgpDynamicNeighbor) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighbor) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *BgpDynamicNeighbor) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *BgpDynamicNeighbor) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *BgpDynamicNeighbor) GetCreatedBy() UserLimited { + if o == nil || IsNil(o.CreatedBy) { + var ret UserLimited + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighbor) GetCreatedByOk() (*UserLimited, bool) { + if o == nil || IsNil(o.CreatedBy) { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *BgpDynamicNeighbor) HasCreatedBy() bool { + if o != nil && !IsNil(o.CreatedBy) { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given UserLimited and assigns it to the CreatedBy field. +func (o *BgpDynamicNeighbor) SetCreatedBy(v UserLimited) { + o.CreatedBy = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *BgpDynamicNeighbor) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighbor) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *BgpDynamicNeighbor) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *BgpDynamicNeighbor) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *BgpDynamicNeighbor) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighbor) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *BgpDynamicNeighbor) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *BgpDynamicNeighbor) SetTags(v []string) { + o.Tags = v +} + +func (o BgpDynamicNeighbor) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BgpDynamicNeighbor) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.BgpNeighborAsn) { + toSerialize["bgp_neighbor_asn"] = o.BgpNeighborAsn + } + if !IsNil(o.BgpNeighborRange) { + toSerialize["bgp_neighbor_range"] = o.BgpNeighborRange + } + if !IsNil(o.MetalGateway) { + toSerialize["metal_gateway"] = o.MetalGateway + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.CreatedBy) { + toSerialize["created_by"] = o.CreatedBy + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BgpDynamicNeighbor) UnmarshalJSON(data []byte) (err error) { + varBgpDynamicNeighbor := _BgpDynamicNeighbor{} + + err = json.Unmarshal(data, &varBgpDynamicNeighbor) + + if err != nil { + return err + } + + *o = BgpDynamicNeighbor(varBgpDynamicNeighbor) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "bgp_neighbor_asn") + delete(additionalProperties, "bgp_neighbor_range") + delete(additionalProperties, "metal_gateway") + delete(additionalProperties, "state") + delete(additionalProperties, "href") + delete(additionalProperties, "created_at") + delete(additionalProperties, "created_by") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBgpDynamicNeighbor struct { + value *BgpDynamicNeighbor + isSet bool +} + +func (v NullableBgpDynamicNeighbor) Get() *BgpDynamicNeighbor { + return v.value +} + +func (v *NullableBgpDynamicNeighbor) Set(val *BgpDynamicNeighbor) { + v.value = val + v.isSet = true +} + +func (v NullableBgpDynamicNeighbor) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpDynamicNeighbor) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpDynamicNeighbor(val *BgpDynamicNeighbor) *NullableBgpDynamicNeighbor { + return &NullableBgpDynamicNeighbor{value: val, isSet: true} +} + +func (v NullableBgpDynamicNeighbor) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpDynamicNeighbor) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_create_input.go new file mode 100644 index 00000000..89837394 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_create_input.go @@ -0,0 +1,235 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the BgpDynamicNeighborCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BgpDynamicNeighborCreateInput{} + +// BgpDynamicNeighborCreateInput struct for BgpDynamicNeighborCreateInput +type BgpDynamicNeighborCreateInput struct { + // Network range of the dynamic BGP neighbor in CIDR format + BgpNeighborRange string `json:"bgp_neighbor_range"` + // The ASN of the dynamic BGP neighbor + BgpNeighborAsn int32 `json:"bgp_neighbor_asn"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BgpDynamicNeighborCreateInput BgpDynamicNeighborCreateInput + +// NewBgpDynamicNeighborCreateInput instantiates a new BgpDynamicNeighborCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBgpDynamicNeighborCreateInput(bgpNeighborRange string, bgpNeighborAsn int32) *BgpDynamicNeighborCreateInput { + this := BgpDynamicNeighborCreateInput{} + this.BgpNeighborRange = bgpNeighborRange + this.BgpNeighborAsn = bgpNeighborAsn + return &this +} + +// NewBgpDynamicNeighborCreateInputWithDefaults instantiates a new BgpDynamicNeighborCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBgpDynamicNeighborCreateInputWithDefaults() *BgpDynamicNeighborCreateInput { + this := BgpDynamicNeighborCreateInput{} + return &this +} + +// GetBgpNeighborRange returns the BgpNeighborRange field value +func (o *BgpDynamicNeighborCreateInput) GetBgpNeighborRange() string { + if o == nil { + var ret string + return ret + } + + return o.BgpNeighborRange +} + +// GetBgpNeighborRangeOk returns a tuple with the BgpNeighborRange field value +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighborCreateInput) GetBgpNeighborRangeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BgpNeighborRange, true +} + +// SetBgpNeighborRange sets field value +func (o *BgpDynamicNeighborCreateInput) SetBgpNeighborRange(v string) { + o.BgpNeighborRange = v +} + +// GetBgpNeighborAsn returns the BgpNeighborAsn field value +func (o *BgpDynamicNeighborCreateInput) GetBgpNeighborAsn() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.BgpNeighborAsn +} + +// GetBgpNeighborAsnOk returns a tuple with the BgpNeighborAsn field value +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighborCreateInput) GetBgpNeighborAsnOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.BgpNeighborAsn, true +} + +// SetBgpNeighborAsn sets field value +func (o *BgpDynamicNeighborCreateInput) SetBgpNeighborAsn(v int32) { + o.BgpNeighborAsn = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *BgpDynamicNeighborCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighborCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *BgpDynamicNeighborCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *BgpDynamicNeighborCreateInput) SetTags(v []string) { + o.Tags = v +} + +func (o BgpDynamicNeighborCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BgpDynamicNeighborCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["bgp_neighbor_range"] = o.BgpNeighborRange + toSerialize["bgp_neighbor_asn"] = o.BgpNeighborAsn + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BgpDynamicNeighborCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "bgp_neighbor_range", + "bgp_neighbor_asn", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varBgpDynamicNeighborCreateInput := _BgpDynamicNeighborCreateInput{} + + err = json.Unmarshal(data, &varBgpDynamicNeighborCreateInput) + + if err != nil { + return err + } + + *o = BgpDynamicNeighborCreateInput(varBgpDynamicNeighborCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bgp_neighbor_range") + delete(additionalProperties, "bgp_neighbor_asn") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBgpDynamicNeighborCreateInput struct { + value *BgpDynamicNeighborCreateInput + isSet bool +} + +func (v NullableBgpDynamicNeighborCreateInput) Get() *BgpDynamicNeighborCreateInput { + return v.value +} + +func (v *NullableBgpDynamicNeighborCreateInput) Set(val *BgpDynamicNeighborCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableBgpDynamicNeighborCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpDynamicNeighborCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpDynamicNeighborCreateInput(val *BgpDynamicNeighborCreateInput) *NullableBgpDynamicNeighborCreateInput { + return &NullableBgpDynamicNeighborCreateInput{value: val, isSet: true} +} + +func (v NullableBgpDynamicNeighborCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpDynamicNeighborCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_list.go new file mode 100644 index 00000000..a387fc4d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_list.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the BgpDynamicNeighborList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BgpDynamicNeighborList{} + +// BgpDynamicNeighborList struct for BgpDynamicNeighborList +type BgpDynamicNeighborList struct { + BgpDynamicNeighbors []BgpDynamicNeighbor `json:"bgp_dynamic_neighbors,omitempty"` + Meta *Meta `json:"meta,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BgpDynamicNeighborList BgpDynamicNeighborList + +// NewBgpDynamicNeighborList instantiates a new BgpDynamicNeighborList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBgpDynamicNeighborList() *BgpDynamicNeighborList { + this := BgpDynamicNeighborList{} + return &this +} + +// NewBgpDynamicNeighborListWithDefaults instantiates a new BgpDynamicNeighborList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBgpDynamicNeighborListWithDefaults() *BgpDynamicNeighborList { + this := BgpDynamicNeighborList{} + return &this +} + +// GetBgpDynamicNeighbors returns the BgpDynamicNeighbors field value if set, zero value otherwise. +func (o *BgpDynamicNeighborList) GetBgpDynamicNeighbors() []BgpDynamicNeighbor { + if o == nil || IsNil(o.BgpDynamicNeighbors) { + var ret []BgpDynamicNeighbor + return ret + } + return o.BgpDynamicNeighbors +} + +// GetBgpDynamicNeighborsOk returns a tuple with the BgpDynamicNeighbors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighborList) GetBgpDynamicNeighborsOk() ([]BgpDynamicNeighbor, bool) { + if o == nil || IsNil(o.BgpDynamicNeighbors) { + return nil, false + } + return o.BgpDynamicNeighbors, true +} + +// HasBgpDynamicNeighbors returns a boolean if a field has been set. +func (o *BgpDynamicNeighborList) HasBgpDynamicNeighbors() bool { + if o != nil && !IsNil(o.BgpDynamicNeighbors) { + return true + } + + return false +} + +// SetBgpDynamicNeighbors gets a reference to the given []BgpDynamicNeighbor and assigns it to the BgpDynamicNeighbors field. +func (o *BgpDynamicNeighborList) SetBgpDynamicNeighbors(v []BgpDynamicNeighbor) { + o.BgpDynamicNeighbors = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *BgpDynamicNeighborList) GetMeta() Meta { + if o == nil || IsNil(o.Meta) { + var ret Meta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpDynamicNeighborList) GetMetaOk() (*Meta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *BgpDynamicNeighborList) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given Meta and assigns it to the Meta field. +func (o *BgpDynamicNeighborList) SetMeta(v Meta) { + o.Meta = &v +} + +func (o BgpDynamicNeighborList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BgpDynamicNeighborList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BgpDynamicNeighbors) { + toSerialize["bgp_dynamic_neighbors"] = o.BgpDynamicNeighbors + } + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BgpDynamicNeighborList) UnmarshalJSON(data []byte) (err error) { + varBgpDynamicNeighborList := _BgpDynamicNeighborList{} + + err = json.Unmarshal(data, &varBgpDynamicNeighborList) + + if err != nil { + return err + } + + *o = BgpDynamicNeighborList(varBgpDynamicNeighborList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bgp_dynamic_neighbors") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBgpDynamicNeighborList struct { + value *BgpDynamicNeighborList + isSet bool +} + +func (v NullableBgpDynamicNeighborList) Get() *BgpDynamicNeighborList { + return v.value +} + +func (v *NullableBgpDynamicNeighborList) Set(val *BgpDynamicNeighborList) { + v.value = val + v.isSet = true +} + +func (v NullableBgpDynamicNeighborList) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpDynamicNeighborList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpDynamicNeighborList(val *BgpDynamicNeighborList) *NullableBgpDynamicNeighborList { + return &NullableBgpDynamicNeighborList{value: val, isSet: true} +} + +func (v NullableBgpDynamicNeighborList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpDynamicNeighborList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_state.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_state.go new file mode 100644 index 00000000..5f52577c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_dynamic_neighbor_state.go @@ -0,0 +1,115 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// BgpDynamicNeighborState the model 'BgpDynamicNeighborState' +type BgpDynamicNeighborState string + +// List of BgpDynamicNeighbor_state +const ( + BGPDYNAMICNEIGHBORSTATE_ACTIVE BgpDynamicNeighborState = "active" + BGPDYNAMICNEIGHBORSTATE_DELETING BgpDynamicNeighborState = "deleting" + BGPDYNAMICNEIGHBORSTATE_PENDING BgpDynamicNeighborState = "pending" + BGPDYNAMICNEIGHBORSTATE_READY BgpDynamicNeighborState = "ready" +) + +// All allowed values of BgpDynamicNeighborState enum +var AllowedBgpDynamicNeighborStateEnumValues = []BgpDynamicNeighborState{ + "active", + "deleting", + "pending", + "ready", +} + +func (v *BgpDynamicNeighborState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := BgpDynamicNeighborState(value) + for _, existing := range AllowedBgpDynamicNeighborStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid BgpDynamicNeighborState", value) +} + +// NewBgpDynamicNeighborStateFromValue returns a pointer to a valid BgpDynamicNeighborState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewBgpDynamicNeighborStateFromValue(v string) (*BgpDynamicNeighborState, error) { + ev := BgpDynamicNeighborState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for BgpDynamicNeighborState: valid values are %v", v, AllowedBgpDynamicNeighborStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v BgpDynamicNeighborState) IsValid() bool { + for _, existing := range AllowedBgpDynamicNeighborStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to BgpDynamicNeighbor_state value +func (v BgpDynamicNeighborState) Ptr() *BgpDynamicNeighborState { + return &v +} + +type NullableBgpDynamicNeighborState struct { + value *BgpDynamicNeighborState + isSet bool +} + +func (v NullableBgpDynamicNeighborState) Get() *BgpDynamicNeighborState { + return v.value +} + +func (v *NullableBgpDynamicNeighborState) Set(val *BgpDynamicNeighborState) { + v.value = val + v.isSet = true +} + +func (v NullableBgpDynamicNeighborState) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpDynamicNeighborState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpDynamicNeighborState(val *BgpDynamicNeighborState) *NullableBgpDynamicNeighborState { + return &NullableBgpDynamicNeighborState{value: val, isSet: true} +} + +func (v NullableBgpDynamicNeighborState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpDynamicNeighborState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_neighbor_data.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_neighbor_data.go new file mode 100644 index 00000000..21c44b1c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_neighbor_data.go @@ -0,0 +1,497 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the BgpNeighborData type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BgpNeighborData{} + +// BgpNeighborData struct for BgpNeighborData +type BgpNeighborData struct { + // Address Family for IP Address. Accepted values are 4 or 6 + AddressFamily *int32 `json:"address_family,omitempty"` + // The customer's ASN. In a local BGP deployment, this will be an internal ASN used to route within the data center. For a global BGP deployment, this will be the your own ASN, configured when you set up BGP for your project. + CustomerAs *int32 `json:"customer_as,omitempty"` + // The device's IP address. For an IPv4 BGP session, this is typically the private bond0 address for the device. + CustomerIp *string `json:"customer_ip,omitempty"` + // True if an MD5 password is configured for the project. + Md5Enabled *bool `json:"md5_enabled,omitempty"` + // The MD5 password configured for the project, if set. + Md5Password *string `json:"md5_password,omitempty"` + // True when the BGP session should be configured as multihop. + Multihop *bool `json:"multihop,omitempty"` + // The Peer ASN to use when configuring BGP on your device. + PeerAs *int32 `json:"peer_as,omitempty"` + // A list of one or more IP addresses to use for the Peer IP section of your BGP configuration. For non-multihop sessions, this will typically be a single gateway address for the device. For multihop sessions, it will be a list of IPs. + PeerIps []string `json:"peer_ips,omitempty"` + // A list of project subnets + RoutesIn []BgpRoute `json:"routes_in,omitempty"` + // A list of outgoing routes. Only populated if the BGP session has default route enabled. + RoutesOut []BgpRoute `json:"routes_out,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BgpNeighborData BgpNeighborData + +// NewBgpNeighborData instantiates a new BgpNeighborData object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBgpNeighborData() *BgpNeighborData { + this := BgpNeighborData{} + return &this +} + +// NewBgpNeighborDataWithDefaults instantiates a new BgpNeighborData object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBgpNeighborDataWithDefaults() *BgpNeighborData { + this := BgpNeighborData{} + return &this +} + +// GetAddressFamily returns the AddressFamily field value if set, zero value otherwise. +func (o *BgpNeighborData) GetAddressFamily() int32 { + if o == nil || IsNil(o.AddressFamily) { + var ret int32 + return ret + } + return *o.AddressFamily +} + +// GetAddressFamilyOk returns a tuple with the AddressFamily field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpNeighborData) GetAddressFamilyOk() (*int32, bool) { + if o == nil || IsNil(o.AddressFamily) { + return nil, false + } + return o.AddressFamily, true +} + +// HasAddressFamily returns a boolean if a field has been set. +func (o *BgpNeighborData) HasAddressFamily() bool { + if o != nil && !IsNil(o.AddressFamily) { + return true + } + + return false +} + +// SetAddressFamily gets a reference to the given int32 and assigns it to the AddressFamily field. +func (o *BgpNeighborData) SetAddressFamily(v int32) { + o.AddressFamily = &v +} + +// GetCustomerAs returns the CustomerAs field value if set, zero value otherwise. +func (o *BgpNeighborData) GetCustomerAs() int32 { + if o == nil || IsNil(o.CustomerAs) { + var ret int32 + return ret + } + return *o.CustomerAs +} + +// GetCustomerAsOk returns a tuple with the CustomerAs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpNeighborData) GetCustomerAsOk() (*int32, bool) { + if o == nil || IsNil(o.CustomerAs) { + return nil, false + } + return o.CustomerAs, true +} + +// HasCustomerAs returns a boolean if a field has been set. +func (o *BgpNeighborData) HasCustomerAs() bool { + if o != nil && !IsNil(o.CustomerAs) { + return true + } + + return false +} + +// SetCustomerAs gets a reference to the given int32 and assigns it to the CustomerAs field. +func (o *BgpNeighborData) SetCustomerAs(v int32) { + o.CustomerAs = &v +} + +// GetCustomerIp returns the CustomerIp field value if set, zero value otherwise. +func (o *BgpNeighborData) GetCustomerIp() string { + if o == nil || IsNil(o.CustomerIp) { + var ret string + return ret + } + return *o.CustomerIp +} + +// GetCustomerIpOk returns a tuple with the CustomerIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpNeighborData) GetCustomerIpOk() (*string, bool) { + if o == nil || IsNil(o.CustomerIp) { + return nil, false + } + return o.CustomerIp, true +} + +// HasCustomerIp returns a boolean if a field has been set. +func (o *BgpNeighborData) HasCustomerIp() bool { + if o != nil && !IsNil(o.CustomerIp) { + return true + } + + return false +} + +// SetCustomerIp gets a reference to the given string and assigns it to the CustomerIp field. +func (o *BgpNeighborData) SetCustomerIp(v string) { + o.CustomerIp = &v +} + +// GetMd5Enabled returns the Md5Enabled field value if set, zero value otherwise. +func (o *BgpNeighborData) GetMd5Enabled() bool { + if o == nil || IsNil(o.Md5Enabled) { + var ret bool + return ret + } + return *o.Md5Enabled +} + +// GetMd5EnabledOk returns a tuple with the Md5Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpNeighborData) GetMd5EnabledOk() (*bool, bool) { + if o == nil || IsNil(o.Md5Enabled) { + return nil, false + } + return o.Md5Enabled, true +} + +// HasMd5Enabled returns a boolean if a field has been set. +func (o *BgpNeighborData) HasMd5Enabled() bool { + if o != nil && !IsNil(o.Md5Enabled) { + return true + } + + return false +} + +// SetMd5Enabled gets a reference to the given bool and assigns it to the Md5Enabled field. +func (o *BgpNeighborData) SetMd5Enabled(v bool) { + o.Md5Enabled = &v +} + +// GetMd5Password returns the Md5Password field value if set, zero value otherwise. +func (o *BgpNeighborData) GetMd5Password() string { + if o == nil || IsNil(o.Md5Password) { + var ret string + return ret + } + return *o.Md5Password +} + +// GetMd5PasswordOk returns a tuple with the Md5Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpNeighborData) GetMd5PasswordOk() (*string, bool) { + if o == nil || IsNil(o.Md5Password) { + return nil, false + } + return o.Md5Password, true +} + +// HasMd5Password returns a boolean if a field has been set. +func (o *BgpNeighborData) HasMd5Password() bool { + if o != nil && !IsNil(o.Md5Password) { + return true + } + + return false +} + +// SetMd5Password gets a reference to the given string and assigns it to the Md5Password field. +func (o *BgpNeighborData) SetMd5Password(v string) { + o.Md5Password = &v +} + +// GetMultihop returns the Multihop field value if set, zero value otherwise. +func (o *BgpNeighborData) GetMultihop() bool { + if o == nil || IsNil(o.Multihop) { + var ret bool + return ret + } + return *o.Multihop +} + +// GetMultihopOk returns a tuple with the Multihop field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpNeighborData) GetMultihopOk() (*bool, bool) { + if o == nil || IsNil(o.Multihop) { + return nil, false + } + return o.Multihop, true +} + +// HasMultihop returns a boolean if a field has been set. +func (o *BgpNeighborData) HasMultihop() bool { + if o != nil && !IsNil(o.Multihop) { + return true + } + + return false +} + +// SetMultihop gets a reference to the given bool and assigns it to the Multihop field. +func (o *BgpNeighborData) SetMultihop(v bool) { + o.Multihop = &v +} + +// GetPeerAs returns the PeerAs field value if set, zero value otherwise. +func (o *BgpNeighborData) GetPeerAs() int32 { + if o == nil || IsNil(o.PeerAs) { + var ret int32 + return ret + } + return *o.PeerAs +} + +// GetPeerAsOk returns a tuple with the PeerAs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpNeighborData) GetPeerAsOk() (*int32, bool) { + if o == nil || IsNil(o.PeerAs) { + return nil, false + } + return o.PeerAs, true +} + +// HasPeerAs returns a boolean if a field has been set. +func (o *BgpNeighborData) HasPeerAs() bool { + if o != nil && !IsNil(o.PeerAs) { + return true + } + + return false +} + +// SetPeerAs gets a reference to the given int32 and assigns it to the PeerAs field. +func (o *BgpNeighborData) SetPeerAs(v int32) { + o.PeerAs = &v +} + +// GetPeerIps returns the PeerIps field value if set, zero value otherwise. +func (o *BgpNeighborData) GetPeerIps() []string { + if o == nil || IsNil(o.PeerIps) { + var ret []string + return ret + } + return o.PeerIps +} + +// GetPeerIpsOk returns a tuple with the PeerIps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpNeighborData) GetPeerIpsOk() ([]string, bool) { + if o == nil || IsNil(o.PeerIps) { + return nil, false + } + return o.PeerIps, true +} + +// HasPeerIps returns a boolean if a field has been set. +func (o *BgpNeighborData) HasPeerIps() bool { + if o != nil && !IsNil(o.PeerIps) { + return true + } + + return false +} + +// SetPeerIps gets a reference to the given []string and assigns it to the PeerIps field. +func (o *BgpNeighborData) SetPeerIps(v []string) { + o.PeerIps = v +} + +// GetRoutesIn returns the RoutesIn field value if set, zero value otherwise. +func (o *BgpNeighborData) GetRoutesIn() []BgpRoute { + if o == nil || IsNil(o.RoutesIn) { + var ret []BgpRoute + return ret + } + return o.RoutesIn +} + +// GetRoutesInOk returns a tuple with the RoutesIn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpNeighborData) GetRoutesInOk() ([]BgpRoute, bool) { + if o == nil || IsNil(o.RoutesIn) { + return nil, false + } + return o.RoutesIn, true +} + +// HasRoutesIn returns a boolean if a field has been set. +func (o *BgpNeighborData) HasRoutesIn() bool { + if o != nil && !IsNil(o.RoutesIn) { + return true + } + + return false +} + +// SetRoutesIn gets a reference to the given []BgpRoute and assigns it to the RoutesIn field. +func (o *BgpNeighborData) SetRoutesIn(v []BgpRoute) { + o.RoutesIn = v +} + +// GetRoutesOut returns the RoutesOut field value if set, zero value otherwise. +func (o *BgpNeighborData) GetRoutesOut() []BgpRoute { + if o == nil || IsNil(o.RoutesOut) { + var ret []BgpRoute + return ret + } + return o.RoutesOut +} + +// GetRoutesOutOk returns a tuple with the RoutesOut field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpNeighborData) GetRoutesOutOk() ([]BgpRoute, bool) { + if o == nil || IsNil(o.RoutesOut) { + return nil, false + } + return o.RoutesOut, true +} + +// HasRoutesOut returns a boolean if a field has been set. +func (o *BgpNeighborData) HasRoutesOut() bool { + if o != nil && !IsNil(o.RoutesOut) { + return true + } + + return false +} + +// SetRoutesOut gets a reference to the given []BgpRoute and assigns it to the RoutesOut field. +func (o *BgpNeighborData) SetRoutesOut(v []BgpRoute) { + o.RoutesOut = v +} + +func (o BgpNeighborData) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BgpNeighborData) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AddressFamily) { + toSerialize["address_family"] = o.AddressFamily + } + if !IsNil(o.CustomerAs) { + toSerialize["customer_as"] = o.CustomerAs + } + if !IsNil(o.CustomerIp) { + toSerialize["customer_ip"] = o.CustomerIp + } + if !IsNil(o.Md5Enabled) { + toSerialize["md5_enabled"] = o.Md5Enabled + } + if !IsNil(o.Md5Password) { + toSerialize["md5_password"] = o.Md5Password + } + if !IsNil(o.Multihop) { + toSerialize["multihop"] = o.Multihop + } + if !IsNil(o.PeerAs) { + toSerialize["peer_as"] = o.PeerAs + } + if !IsNil(o.PeerIps) { + toSerialize["peer_ips"] = o.PeerIps + } + if !IsNil(o.RoutesIn) { + toSerialize["routes_in"] = o.RoutesIn + } + if !IsNil(o.RoutesOut) { + toSerialize["routes_out"] = o.RoutesOut + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BgpNeighborData) UnmarshalJSON(data []byte) (err error) { + varBgpNeighborData := _BgpNeighborData{} + + err = json.Unmarshal(data, &varBgpNeighborData) + + if err != nil { + return err + } + + *o = BgpNeighborData(varBgpNeighborData) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address_family") + delete(additionalProperties, "customer_as") + delete(additionalProperties, "customer_ip") + delete(additionalProperties, "md5_enabled") + delete(additionalProperties, "md5_password") + delete(additionalProperties, "multihop") + delete(additionalProperties, "peer_as") + delete(additionalProperties, "peer_ips") + delete(additionalProperties, "routes_in") + delete(additionalProperties, "routes_out") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBgpNeighborData struct { + value *BgpNeighborData + isSet bool +} + +func (v NullableBgpNeighborData) Get() *BgpNeighborData { + return v.value +} + +func (v *NullableBgpNeighborData) Set(val *BgpNeighborData) { + v.value = val + v.isSet = true +} + +func (v NullableBgpNeighborData) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpNeighborData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpNeighborData(val *BgpNeighborData) *NullableBgpNeighborData { + return &NullableBgpNeighborData{value: val, isSet: true} +} + +func (v NullableBgpNeighborData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpNeighborData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_route.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_route.go new file mode 100644 index 00000000..ffe29cea --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_route.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the BgpRoute type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BgpRoute{} + +// BgpRoute struct for BgpRoute +type BgpRoute struct { + Exact *bool `json:"exact,omitempty"` + Route *string `json:"route,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BgpRoute BgpRoute + +// NewBgpRoute instantiates a new BgpRoute object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBgpRoute() *BgpRoute { + this := BgpRoute{} + return &this +} + +// NewBgpRouteWithDefaults instantiates a new BgpRoute object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBgpRouteWithDefaults() *BgpRoute { + this := BgpRoute{} + return &this +} + +// GetExact returns the Exact field value if set, zero value otherwise. +func (o *BgpRoute) GetExact() bool { + if o == nil || IsNil(o.Exact) { + var ret bool + return ret + } + return *o.Exact +} + +// GetExactOk returns a tuple with the Exact field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpRoute) GetExactOk() (*bool, bool) { + if o == nil || IsNil(o.Exact) { + return nil, false + } + return o.Exact, true +} + +// HasExact returns a boolean if a field has been set. +func (o *BgpRoute) HasExact() bool { + if o != nil && !IsNil(o.Exact) { + return true + } + + return false +} + +// SetExact gets a reference to the given bool and assigns it to the Exact field. +func (o *BgpRoute) SetExact(v bool) { + o.Exact = &v +} + +// GetRoute returns the Route field value if set, zero value otherwise. +func (o *BgpRoute) GetRoute() string { + if o == nil || IsNil(o.Route) { + var ret string + return ret + } + return *o.Route +} + +// GetRouteOk returns a tuple with the Route field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpRoute) GetRouteOk() (*string, bool) { + if o == nil || IsNil(o.Route) { + return nil, false + } + return o.Route, true +} + +// HasRoute returns a boolean if a field has been set. +func (o *BgpRoute) HasRoute() bool { + if o != nil && !IsNil(o.Route) { + return true + } + + return false +} + +// SetRoute gets a reference to the given string and assigns it to the Route field. +func (o *BgpRoute) SetRoute(v string) { + o.Route = &v +} + +func (o BgpRoute) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BgpRoute) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Exact) { + toSerialize["exact"] = o.Exact + } + if !IsNil(o.Route) { + toSerialize["route"] = o.Route + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BgpRoute) UnmarshalJSON(data []byte) (err error) { + varBgpRoute := _BgpRoute{} + + err = json.Unmarshal(data, &varBgpRoute) + + if err != nil { + return err + } + + *o = BgpRoute(varBgpRoute) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "exact") + delete(additionalProperties, "route") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBgpRoute struct { + value *BgpRoute + isSet bool +} + +func (v NullableBgpRoute) Get() *BgpRoute { + return v.value +} + +func (v *NullableBgpRoute) Set(val *BgpRoute) { + v.value = val + v.isSet = true +} + +func (v NullableBgpRoute) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpRoute) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpRoute(val *BgpRoute) *NullableBgpRoute { + return &NullableBgpRoute{value: val, isSet: true} +} + +func (v NullableBgpRoute) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpRoute) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session.go new file mode 100644 index 00000000..00d47585 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session.go @@ -0,0 +1,465 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the BgpSession type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BgpSession{} + +// BgpSession struct for BgpSession +type BgpSession struct { + AddressFamily BgpSessionAddressFamily `json:"address_family"` + CreatedAt *time.Time `json:"created_at,omitempty"` + DefaultRoute *bool `json:"default_route,omitempty"` + Device *Href `json:"device,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + LearnedRoutes []string `json:"learned_routes,omitempty"` + // The status of the BGP Session. Multiple status values may be reported when the device is connected to multiple switches, one value per switch. Each status will start with \"unknown\" and progress to \"up\" or \"down\" depending on the connected device. Subsequent \"unknown\" values indicate a problem acquiring status from the switch. + Status *string `json:"status,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BgpSession BgpSession + +// NewBgpSession instantiates a new BgpSession object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBgpSession(addressFamily BgpSessionAddressFamily) *BgpSession { + this := BgpSession{} + this.AddressFamily = addressFamily + return &this +} + +// NewBgpSessionWithDefaults instantiates a new BgpSession object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBgpSessionWithDefaults() *BgpSession { + this := BgpSession{} + return &this +} + +// GetAddressFamily returns the AddressFamily field value +func (o *BgpSession) GetAddressFamily() BgpSessionAddressFamily { + if o == nil { + var ret BgpSessionAddressFamily + return ret + } + + return o.AddressFamily +} + +// GetAddressFamilyOk returns a tuple with the AddressFamily field value +// and a boolean to check if the value has been set. +func (o *BgpSession) GetAddressFamilyOk() (*BgpSessionAddressFamily, bool) { + if o == nil { + return nil, false + } + return &o.AddressFamily, true +} + +// SetAddressFamily sets field value +func (o *BgpSession) SetAddressFamily(v BgpSessionAddressFamily) { + o.AddressFamily = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *BgpSession) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpSession) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *BgpSession) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *BgpSession) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDefaultRoute returns the DefaultRoute field value if set, zero value otherwise. +func (o *BgpSession) GetDefaultRoute() bool { + if o == nil || IsNil(o.DefaultRoute) { + var ret bool + return ret + } + return *o.DefaultRoute +} + +// GetDefaultRouteOk returns a tuple with the DefaultRoute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpSession) GetDefaultRouteOk() (*bool, bool) { + if o == nil || IsNil(o.DefaultRoute) { + return nil, false + } + return o.DefaultRoute, true +} + +// HasDefaultRoute returns a boolean if a field has been set. +func (o *BgpSession) HasDefaultRoute() bool { + if o != nil && !IsNil(o.DefaultRoute) { + return true + } + + return false +} + +// SetDefaultRoute gets a reference to the given bool and assigns it to the DefaultRoute field. +func (o *BgpSession) SetDefaultRoute(v bool) { + o.DefaultRoute = &v +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *BgpSession) GetDevice() Href { + if o == nil || IsNil(o.Device) { + var ret Href + return ret + } + return *o.Device +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpSession) GetDeviceOk() (*Href, bool) { + if o == nil || IsNil(o.Device) { + return nil, false + } + return o.Device, true +} + +// HasDevice returns a boolean if a field has been set. +func (o *BgpSession) HasDevice() bool { + if o != nil && !IsNil(o.Device) { + return true + } + + return false +} + +// SetDevice gets a reference to the given Href and assigns it to the Device field. +func (o *BgpSession) SetDevice(v Href) { + o.Device = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *BgpSession) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpSession) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *BgpSession) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *BgpSession) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BgpSession) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpSession) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BgpSession) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BgpSession) SetId(v string) { + o.Id = &v +} + +// GetLearnedRoutes returns the LearnedRoutes field value if set, zero value otherwise. +func (o *BgpSession) GetLearnedRoutes() []string { + if o == nil || IsNil(o.LearnedRoutes) { + var ret []string + return ret + } + return o.LearnedRoutes +} + +// GetLearnedRoutesOk returns a tuple with the LearnedRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpSession) GetLearnedRoutesOk() ([]string, bool) { + if o == nil || IsNil(o.LearnedRoutes) { + return nil, false + } + return o.LearnedRoutes, true +} + +// HasLearnedRoutes returns a boolean if a field has been set. +func (o *BgpSession) HasLearnedRoutes() bool { + if o != nil && !IsNil(o.LearnedRoutes) { + return true + } + + return false +} + +// SetLearnedRoutes gets a reference to the given []string and assigns it to the LearnedRoutes field. +func (o *BgpSession) SetLearnedRoutes(v []string) { + o.LearnedRoutes = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *BgpSession) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpSession) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *BgpSession) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *BgpSession) SetStatus(v string) { + o.Status = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *BgpSession) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpSession) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *BgpSession) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *BgpSession) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o BgpSession) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BgpSession) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["address_family"] = o.AddressFamily + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.DefaultRoute) { + toSerialize["default_route"] = o.DefaultRoute + } + if !IsNil(o.Device) { + toSerialize["device"] = o.Device + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.LearnedRoutes) { + toSerialize["learned_routes"] = o.LearnedRoutes + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BgpSession) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "address_family", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varBgpSession := _BgpSession{} + + err = json.Unmarshal(data, &varBgpSession) + + if err != nil { + return err + } + + *o = BgpSession(varBgpSession) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address_family") + delete(additionalProperties, "created_at") + delete(additionalProperties, "default_route") + delete(additionalProperties, "device") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "learned_routes") + delete(additionalProperties, "status") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBgpSession struct { + value *BgpSession + isSet bool +} + +func (v NullableBgpSession) Get() *BgpSession { + return v.value +} + +func (v *NullableBgpSession) Set(val *BgpSession) { + v.value = val + v.isSet = true +} + +func (v NullableBgpSession) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpSession) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpSession(val *BgpSession) *NullableBgpSession { + return &NullableBgpSession{value: val, isSet: true} +} + +func (v NullableBgpSession) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpSession) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_address_family.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_address_family.go new file mode 100644 index 00000000..8cab0b19 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_address_family.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// BgpSessionAddressFamily the model 'BgpSessionAddressFamily' +type BgpSessionAddressFamily string + +// List of BgpSession_address_family +const ( + BGPSESSIONADDRESSFAMILY_IPV4 BgpSessionAddressFamily = "ipv4" + BGPSESSIONADDRESSFAMILY_IPV6 BgpSessionAddressFamily = "ipv6" +) + +// All allowed values of BgpSessionAddressFamily enum +var AllowedBgpSessionAddressFamilyEnumValues = []BgpSessionAddressFamily{ + "ipv4", + "ipv6", +} + +func (v *BgpSessionAddressFamily) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := BgpSessionAddressFamily(value) + for _, existing := range AllowedBgpSessionAddressFamilyEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid BgpSessionAddressFamily", value) +} + +// NewBgpSessionAddressFamilyFromValue returns a pointer to a valid BgpSessionAddressFamily +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewBgpSessionAddressFamilyFromValue(v string) (*BgpSessionAddressFamily, error) { + ev := BgpSessionAddressFamily(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for BgpSessionAddressFamily: valid values are %v", v, AllowedBgpSessionAddressFamilyEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v BgpSessionAddressFamily) IsValid() bool { + for _, existing := range AllowedBgpSessionAddressFamilyEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to BgpSession_address_family value +func (v BgpSessionAddressFamily) Ptr() *BgpSessionAddressFamily { + return &v +} + +type NullableBgpSessionAddressFamily struct { + value *BgpSessionAddressFamily + isSet bool +} + +func (v NullableBgpSessionAddressFamily) Get() *BgpSessionAddressFamily { + return v.value +} + +func (v *NullableBgpSessionAddressFamily) Set(val *BgpSessionAddressFamily) { + v.value = val + v.isSet = true +} + +func (v NullableBgpSessionAddressFamily) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpSessionAddressFamily) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpSessionAddressFamily(val *BgpSessionAddressFamily) *NullableBgpSessionAddressFamily { + return &NullableBgpSessionAddressFamily{value: val, isSet: true} +} + +func (v NullableBgpSessionAddressFamily) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpSessionAddressFamily) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_input.go new file mode 100644 index 00000000..364a84cd --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_input.go @@ -0,0 +1,196 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the BGPSessionInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPSessionInput{} + +// BGPSessionInput struct for BGPSessionInput +type BGPSessionInput struct { + AddressFamily *BGPSessionInputAddressFamily `json:"address_family,omitempty"` + // Set the default route policy. + DefaultRoute *bool `json:"default_route,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BGPSessionInput BGPSessionInput + +// NewBGPSessionInput instantiates a new BGPSessionInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBGPSessionInput() *BGPSessionInput { + this := BGPSessionInput{} + var defaultRoute bool = false + this.DefaultRoute = &defaultRoute + return &this +} + +// NewBGPSessionInputWithDefaults instantiates a new BGPSessionInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBGPSessionInputWithDefaults() *BGPSessionInput { + this := BGPSessionInput{} + var defaultRoute bool = false + this.DefaultRoute = &defaultRoute + return &this +} + +// GetAddressFamily returns the AddressFamily field value if set, zero value otherwise. +func (o *BGPSessionInput) GetAddressFamily() BGPSessionInputAddressFamily { + if o == nil || IsNil(o.AddressFamily) { + var ret BGPSessionInputAddressFamily + return ret + } + return *o.AddressFamily +} + +// GetAddressFamilyOk returns a tuple with the AddressFamily field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPSessionInput) GetAddressFamilyOk() (*BGPSessionInputAddressFamily, bool) { + if o == nil || IsNil(o.AddressFamily) { + return nil, false + } + return o.AddressFamily, true +} + +// HasAddressFamily returns a boolean if a field has been set. +func (o *BGPSessionInput) HasAddressFamily() bool { + if o != nil && !IsNil(o.AddressFamily) { + return true + } + + return false +} + +// SetAddressFamily gets a reference to the given BGPSessionInputAddressFamily and assigns it to the AddressFamily field. +func (o *BGPSessionInput) SetAddressFamily(v BGPSessionInputAddressFamily) { + o.AddressFamily = &v +} + +// GetDefaultRoute returns the DefaultRoute field value if set, zero value otherwise. +func (o *BGPSessionInput) GetDefaultRoute() bool { + if o == nil || IsNil(o.DefaultRoute) { + var ret bool + return ret + } + return *o.DefaultRoute +} + +// GetDefaultRouteOk returns a tuple with the DefaultRoute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPSessionInput) GetDefaultRouteOk() (*bool, bool) { + if o == nil || IsNil(o.DefaultRoute) { + return nil, false + } + return o.DefaultRoute, true +} + +// HasDefaultRoute returns a boolean if a field has been set. +func (o *BGPSessionInput) HasDefaultRoute() bool { + if o != nil && !IsNil(o.DefaultRoute) { + return true + } + + return false +} + +// SetDefaultRoute gets a reference to the given bool and assigns it to the DefaultRoute field. +func (o *BGPSessionInput) SetDefaultRoute(v bool) { + o.DefaultRoute = &v +} + +func (o BGPSessionInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPSessionInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AddressFamily) { + toSerialize["address_family"] = o.AddressFamily + } + if !IsNil(o.DefaultRoute) { + toSerialize["default_route"] = o.DefaultRoute + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPSessionInput) UnmarshalJSON(data []byte) (err error) { + varBGPSessionInput := _BGPSessionInput{} + + err = json.Unmarshal(data, &varBGPSessionInput) + + if err != nil { + return err + } + + *o = BGPSessionInput(varBGPSessionInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address_family") + delete(additionalProperties, "default_route") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPSessionInput struct { + value *BGPSessionInput + isSet bool +} + +func (v NullableBGPSessionInput) Get() *BGPSessionInput { + return v.value +} + +func (v *NullableBGPSessionInput) Set(val *BGPSessionInput) { + v.value = val + v.isSet = true +} + +func (v NullableBGPSessionInput) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPSessionInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPSessionInput(val *BGPSessionInput) *NullableBGPSessionInput { + return &NullableBGPSessionInput{value: val, isSet: true} +} + +func (v NullableBGPSessionInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPSessionInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_input_address_family.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_input_address_family.go new file mode 100644 index 00000000..90cfd8f1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_input_address_family.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// BGPSessionInputAddressFamily Address family for BGP session. +type BGPSessionInputAddressFamily string + +// List of BGPSessionInput_address_family +const ( + BGPSESSIONINPUTADDRESSFAMILY_IPV4 BGPSessionInputAddressFamily = "ipv4" + BGPSESSIONINPUTADDRESSFAMILY_IPV6 BGPSessionInputAddressFamily = "ipv6" +) + +// All allowed values of BGPSessionInputAddressFamily enum +var AllowedBGPSessionInputAddressFamilyEnumValues = []BGPSessionInputAddressFamily{ + "ipv4", + "ipv6", +} + +func (v *BGPSessionInputAddressFamily) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := BGPSessionInputAddressFamily(value) + for _, existing := range AllowedBGPSessionInputAddressFamilyEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid BGPSessionInputAddressFamily", value) +} + +// NewBGPSessionInputAddressFamilyFromValue returns a pointer to a valid BGPSessionInputAddressFamily +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewBGPSessionInputAddressFamilyFromValue(v string) (*BGPSessionInputAddressFamily, error) { + ev := BGPSessionInputAddressFamily(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for BGPSessionInputAddressFamily: valid values are %v", v, AllowedBGPSessionInputAddressFamilyEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v BGPSessionInputAddressFamily) IsValid() bool { + for _, existing := range AllowedBGPSessionInputAddressFamilyEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to BGPSessionInput_address_family value +func (v BGPSessionInputAddressFamily) Ptr() *BGPSessionInputAddressFamily { + return &v +} + +type NullableBGPSessionInputAddressFamily struct { + value *BGPSessionInputAddressFamily + isSet bool +} + +func (v NullableBGPSessionInputAddressFamily) Get() *BGPSessionInputAddressFamily { + return v.value +} + +func (v *NullableBGPSessionInputAddressFamily) Set(val *BGPSessionInputAddressFamily) { + v.value = val + v.isSet = true +} + +func (v NullableBGPSessionInputAddressFamily) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPSessionInputAddressFamily) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPSessionInputAddressFamily(val *BGPSessionInputAddressFamily) *NullableBGPSessionInputAddressFamily { + return &NullableBGPSessionInputAddressFamily{value: val, isSet: true} +} + +func (v NullableBGPSessionInputAddressFamily) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPSessionInputAddressFamily) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_list.go new file mode 100644 index 00000000..cdcbe75e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the BgpSessionList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BgpSessionList{} + +// BgpSessionList struct for BgpSessionList +type BgpSessionList struct { + BgpSessions []BgpSession `json:"bgp_sessions,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BgpSessionList BgpSessionList + +// NewBgpSessionList instantiates a new BgpSessionList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBgpSessionList() *BgpSessionList { + this := BgpSessionList{} + return &this +} + +// NewBgpSessionListWithDefaults instantiates a new BgpSessionList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBgpSessionListWithDefaults() *BgpSessionList { + this := BgpSessionList{} + return &this +} + +// GetBgpSessions returns the BgpSessions field value if set, zero value otherwise. +func (o *BgpSessionList) GetBgpSessions() []BgpSession { + if o == nil || IsNil(o.BgpSessions) { + var ret []BgpSession + return ret + } + return o.BgpSessions +} + +// GetBgpSessionsOk returns a tuple with the BgpSessions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpSessionList) GetBgpSessionsOk() ([]BgpSession, bool) { + if o == nil || IsNil(o.BgpSessions) { + return nil, false + } + return o.BgpSessions, true +} + +// HasBgpSessions returns a boolean if a field has been set. +func (o *BgpSessionList) HasBgpSessions() bool { + if o != nil && !IsNil(o.BgpSessions) { + return true + } + + return false +} + +// SetBgpSessions gets a reference to the given []BgpSession and assigns it to the BgpSessions field. +func (o *BgpSessionList) SetBgpSessions(v []BgpSession) { + o.BgpSessions = v +} + +func (o BgpSessionList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BgpSessionList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BgpSessions) { + toSerialize["bgp_sessions"] = o.BgpSessions + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BgpSessionList) UnmarshalJSON(data []byte) (err error) { + varBgpSessionList := _BgpSessionList{} + + err = json.Unmarshal(data, &varBgpSessionList) + + if err != nil { + return err + } + + *o = BgpSessionList(varBgpSessionList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bgp_sessions") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBgpSessionList struct { + value *BgpSessionList + isSet bool +} + +func (v NullableBgpSessionList) Get() *BgpSessionList { + return v.value +} + +func (v *NullableBgpSessionList) Set(val *BgpSessionList) { + v.value = val + v.isSet = true +} + +func (v NullableBgpSessionList) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpSessionList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpSessionList(val *BgpSessionList) *NullableBgpSessionList { + return &NullableBgpSessionList{value: val, isSet: true} +} + +func (v NullableBgpSessionList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpSessionList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_neighbors.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_neighbors.go new file mode 100644 index 00000000..93605073 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bgp_session_neighbors.go @@ -0,0 +1,155 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the BgpSessionNeighbors type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BgpSessionNeighbors{} + +// BgpSessionNeighbors struct for BgpSessionNeighbors +type BgpSessionNeighbors struct { + // A list of BGP session neighbor data + BgpNeighbors []BgpNeighborData `json:"bgp_neighbors,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BgpSessionNeighbors BgpSessionNeighbors + +// NewBgpSessionNeighbors instantiates a new BgpSessionNeighbors object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBgpSessionNeighbors() *BgpSessionNeighbors { + this := BgpSessionNeighbors{} + return &this +} + +// NewBgpSessionNeighborsWithDefaults instantiates a new BgpSessionNeighbors object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBgpSessionNeighborsWithDefaults() *BgpSessionNeighbors { + this := BgpSessionNeighbors{} + return &this +} + +// GetBgpNeighbors returns the BgpNeighbors field value if set, zero value otherwise. +func (o *BgpSessionNeighbors) GetBgpNeighbors() []BgpNeighborData { + if o == nil || IsNil(o.BgpNeighbors) { + var ret []BgpNeighborData + return ret + } + return o.BgpNeighbors +} + +// GetBgpNeighborsOk returns a tuple with the BgpNeighbors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BgpSessionNeighbors) GetBgpNeighborsOk() ([]BgpNeighborData, bool) { + if o == nil || IsNil(o.BgpNeighbors) { + return nil, false + } + return o.BgpNeighbors, true +} + +// HasBgpNeighbors returns a boolean if a field has been set. +func (o *BgpSessionNeighbors) HasBgpNeighbors() bool { + if o != nil && !IsNil(o.BgpNeighbors) { + return true + } + + return false +} + +// SetBgpNeighbors gets a reference to the given []BgpNeighborData and assigns it to the BgpNeighbors field. +func (o *BgpSessionNeighbors) SetBgpNeighbors(v []BgpNeighborData) { + o.BgpNeighbors = v +} + +func (o BgpSessionNeighbors) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BgpSessionNeighbors) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BgpNeighbors) { + toSerialize["bgp_neighbors"] = o.BgpNeighbors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BgpSessionNeighbors) UnmarshalJSON(data []byte) (err error) { + varBgpSessionNeighbors := _BgpSessionNeighbors{} + + err = json.Unmarshal(data, &varBgpSessionNeighbors) + + if err != nil { + return err + } + + *o = BgpSessionNeighbors(varBgpSessionNeighbors) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bgp_neighbors") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBgpSessionNeighbors struct { + value *BgpSessionNeighbors + isSet bool +} + +func (v NullableBgpSessionNeighbors) Get() *BgpSessionNeighbors { + return v.value +} + +func (v *NullableBgpSessionNeighbors) Set(val *BgpSessionNeighbors) { + v.value = val + v.isSet = true +} + +func (v NullableBgpSessionNeighbors) IsSet() bool { + return v.isSet +} + +func (v *NullableBgpSessionNeighbors) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBgpSessionNeighbors(val *BgpSessionNeighbors) *NullableBgpSessionNeighbors { + return &NullableBgpSessionNeighbors{value: val, isSet: true} +} + +func (v NullableBgpSessionNeighbors) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBgpSessionNeighbors) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bond_port_data.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bond_port_data.go new file mode 100644 index 00000000..e88cf280 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_bond_port_data.go @@ -0,0 +1,193 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the BondPortData type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BondPortData{} + +// BondPortData struct for BondPortData +type BondPortData struct { + // ID of the bonding port + Id *string `json:"id,omitempty"` + // Name of the port interface for the bond (\"bond0\") + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BondPortData BondPortData + +// NewBondPortData instantiates a new BondPortData object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBondPortData() *BondPortData { + this := BondPortData{} + return &this +} + +// NewBondPortDataWithDefaults instantiates a new BondPortData object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBondPortDataWithDefaults() *BondPortData { + this := BondPortData{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BondPortData) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BondPortData) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BondPortData) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BondPortData) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *BondPortData) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BondPortData) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *BondPortData) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *BondPortData) SetName(v string) { + o.Name = &v +} + +func (o BondPortData) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BondPortData) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BondPortData) UnmarshalJSON(data []byte) (err error) { + varBondPortData := _BondPortData{} + + err = json.Unmarshal(data, &varBondPortData) + + if err != nil { + return err + } + + *o = BondPortData(varBondPortData) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBondPortData struct { + value *BondPortData + isSet bool +} + +func (v NullableBondPortData) Get() *BondPortData { + return v.value +} + +func (v *NullableBondPortData) Set(val *BondPortData) { + v.value = val + v.isSet = true +} + +func (v NullableBondPortData) IsSet() bool { + return v.isSet +} + +func (v *NullableBondPortData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBondPortData(val *BondPortData) *NullableBondPortData { + return &NullableBondPortData{value: val, isSet: true} +} + +func (v NullableBondPortData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBondPortData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_facility_info.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_facility_info.go new file mode 100644 index 00000000..41eb3007 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_facility_info.go @@ -0,0 +1,265 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the CapacityCheckPerFacilityInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CapacityCheckPerFacilityInfo{} + +// CapacityCheckPerFacilityInfo struct for CapacityCheckPerFacilityInfo +type CapacityCheckPerFacilityInfo struct { + Available *bool `json:"available,omitempty"` + Facility *string `json:"facility,omitempty"` + Plan *string `json:"plan,omitempty"` + Quantity *string `json:"quantity,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CapacityCheckPerFacilityInfo CapacityCheckPerFacilityInfo + +// NewCapacityCheckPerFacilityInfo instantiates a new CapacityCheckPerFacilityInfo object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCapacityCheckPerFacilityInfo() *CapacityCheckPerFacilityInfo { + this := CapacityCheckPerFacilityInfo{} + return &this +} + +// NewCapacityCheckPerFacilityInfoWithDefaults instantiates a new CapacityCheckPerFacilityInfo object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCapacityCheckPerFacilityInfoWithDefaults() *CapacityCheckPerFacilityInfo { + this := CapacityCheckPerFacilityInfo{} + return &this +} + +// GetAvailable returns the Available field value if set, zero value otherwise. +func (o *CapacityCheckPerFacilityInfo) GetAvailable() bool { + if o == nil || IsNil(o.Available) { + var ret bool + return ret + } + return *o.Available +} + +// GetAvailableOk returns a tuple with the Available field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityCheckPerFacilityInfo) GetAvailableOk() (*bool, bool) { + if o == nil || IsNil(o.Available) { + return nil, false + } + return o.Available, true +} + +// HasAvailable returns a boolean if a field has been set. +func (o *CapacityCheckPerFacilityInfo) HasAvailable() bool { + if o != nil && !IsNil(o.Available) { + return true + } + + return false +} + +// SetAvailable gets a reference to the given bool and assigns it to the Available field. +func (o *CapacityCheckPerFacilityInfo) SetAvailable(v bool) { + o.Available = &v +} + +// GetFacility returns the Facility field value if set, zero value otherwise. +func (o *CapacityCheckPerFacilityInfo) GetFacility() string { + if o == nil || IsNil(o.Facility) { + var ret string + return ret + } + return *o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityCheckPerFacilityInfo) GetFacilityOk() (*string, bool) { + if o == nil || IsNil(o.Facility) { + return nil, false + } + return o.Facility, true +} + +// HasFacility returns a boolean if a field has been set. +func (o *CapacityCheckPerFacilityInfo) HasFacility() bool { + if o != nil && !IsNil(o.Facility) { + return true + } + + return false +} + +// SetFacility gets a reference to the given string and assigns it to the Facility field. +func (o *CapacityCheckPerFacilityInfo) SetFacility(v string) { + o.Facility = &v +} + +// GetPlan returns the Plan field value if set, zero value otherwise. +func (o *CapacityCheckPerFacilityInfo) GetPlan() string { + if o == nil || IsNil(o.Plan) { + var ret string + return ret + } + return *o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityCheckPerFacilityInfo) GetPlanOk() (*string, bool) { + if o == nil || IsNil(o.Plan) { + return nil, false + } + return o.Plan, true +} + +// HasPlan returns a boolean if a field has been set. +func (o *CapacityCheckPerFacilityInfo) HasPlan() bool { + if o != nil && !IsNil(o.Plan) { + return true + } + + return false +} + +// SetPlan gets a reference to the given string and assigns it to the Plan field. +func (o *CapacityCheckPerFacilityInfo) SetPlan(v string) { + o.Plan = &v +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *CapacityCheckPerFacilityInfo) GetQuantity() string { + if o == nil || IsNil(o.Quantity) { + var ret string + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityCheckPerFacilityInfo) GetQuantityOk() (*string, bool) { + if o == nil || IsNil(o.Quantity) { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *CapacityCheckPerFacilityInfo) HasQuantity() bool { + if o != nil && !IsNil(o.Quantity) { + return true + } + + return false +} + +// SetQuantity gets a reference to the given string and assigns it to the Quantity field. +func (o *CapacityCheckPerFacilityInfo) SetQuantity(v string) { + o.Quantity = &v +} + +func (o CapacityCheckPerFacilityInfo) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CapacityCheckPerFacilityInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Available) { + toSerialize["available"] = o.Available + } + if !IsNil(o.Facility) { + toSerialize["facility"] = o.Facility + } + if !IsNil(o.Plan) { + toSerialize["plan"] = o.Plan + } + if !IsNil(o.Quantity) { + toSerialize["quantity"] = o.Quantity + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CapacityCheckPerFacilityInfo) UnmarshalJSON(data []byte) (err error) { + varCapacityCheckPerFacilityInfo := _CapacityCheckPerFacilityInfo{} + + err = json.Unmarshal(data, &varCapacityCheckPerFacilityInfo) + + if err != nil { + return err + } + + *o = CapacityCheckPerFacilityInfo(varCapacityCheckPerFacilityInfo) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "available") + delete(additionalProperties, "facility") + delete(additionalProperties, "plan") + delete(additionalProperties, "quantity") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCapacityCheckPerFacilityInfo struct { + value *CapacityCheckPerFacilityInfo + isSet bool +} + +func (v NullableCapacityCheckPerFacilityInfo) Get() *CapacityCheckPerFacilityInfo { + return v.value +} + +func (v *NullableCapacityCheckPerFacilityInfo) Set(val *CapacityCheckPerFacilityInfo) { + v.value = val + v.isSet = true +} + +func (v NullableCapacityCheckPerFacilityInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableCapacityCheckPerFacilityInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCapacityCheckPerFacilityInfo(val *CapacityCheckPerFacilityInfo) *NullableCapacityCheckPerFacilityInfo { + return &NullableCapacityCheckPerFacilityInfo{value: val, isSet: true} +} + +func (v NullableCapacityCheckPerFacilityInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCapacityCheckPerFacilityInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_facility_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_facility_list.go new file mode 100644 index 00000000..2cb4293e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_facility_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the CapacityCheckPerFacilityList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CapacityCheckPerFacilityList{} + +// CapacityCheckPerFacilityList struct for CapacityCheckPerFacilityList +type CapacityCheckPerFacilityList struct { + Servers []CapacityCheckPerFacilityInfo `json:"servers,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CapacityCheckPerFacilityList CapacityCheckPerFacilityList + +// NewCapacityCheckPerFacilityList instantiates a new CapacityCheckPerFacilityList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCapacityCheckPerFacilityList() *CapacityCheckPerFacilityList { + this := CapacityCheckPerFacilityList{} + return &this +} + +// NewCapacityCheckPerFacilityListWithDefaults instantiates a new CapacityCheckPerFacilityList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCapacityCheckPerFacilityListWithDefaults() *CapacityCheckPerFacilityList { + this := CapacityCheckPerFacilityList{} + return &this +} + +// GetServers returns the Servers field value if set, zero value otherwise. +func (o *CapacityCheckPerFacilityList) GetServers() []CapacityCheckPerFacilityInfo { + if o == nil || IsNil(o.Servers) { + var ret []CapacityCheckPerFacilityInfo + return ret + } + return o.Servers +} + +// GetServersOk returns a tuple with the Servers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityCheckPerFacilityList) GetServersOk() ([]CapacityCheckPerFacilityInfo, bool) { + if o == nil || IsNil(o.Servers) { + return nil, false + } + return o.Servers, true +} + +// HasServers returns a boolean if a field has been set. +func (o *CapacityCheckPerFacilityList) HasServers() bool { + if o != nil && !IsNil(o.Servers) { + return true + } + + return false +} + +// SetServers gets a reference to the given []CapacityCheckPerFacilityInfo and assigns it to the Servers field. +func (o *CapacityCheckPerFacilityList) SetServers(v []CapacityCheckPerFacilityInfo) { + o.Servers = v +} + +func (o CapacityCheckPerFacilityList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CapacityCheckPerFacilityList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Servers) { + toSerialize["servers"] = o.Servers + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CapacityCheckPerFacilityList) UnmarshalJSON(data []byte) (err error) { + varCapacityCheckPerFacilityList := _CapacityCheckPerFacilityList{} + + err = json.Unmarshal(data, &varCapacityCheckPerFacilityList) + + if err != nil { + return err + } + + *o = CapacityCheckPerFacilityList(varCapacityCheckPerFacilityList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "servers") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCapacityCheckPerFacilityList struct { + value *CapacityCheckPerFacilityList + isSet bool +} + +func (v NullableCapacityCheckPerFacilityList) Get() *CapacityCheckPerFacilityList { + return v.value +} + +func (v *NullableCapacityCheckPerFacilityList) Set(val *CapacityCheckPerFacilityList) { + v.value = val + v.isSet = true +} + +func (v NullableCapacityCheckPerFacilityList) IsSet() bool { + return v.isSet +} + +func (v *NullableCapacityCheckPerFacilityList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCapacityCheckPerFacilityList(val *CapacityCheckPerFacilityList) *NullableCapacityCheckPerFacilityList { + return &NullableCapacityCheckPerFacilityList{value: val, isSet: true} +} + +func (v NullableCapacityCheckPerFacilityList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCapacityCheckPerFacilityList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_metro_info.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_metro_info.go new file mode 100644 index 00000000..f31babb4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_metro_info.go @@ -0,0 +1,269 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the CapacityCheckPerMetroInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CapacityCheckPerMetroInfo{} + +// CapacityCheckPerMetroInfo struct for CapacityCheckPerMetroInfo +type CapacityCheckPerMetroInfo struct { + // Returns true if there is enough capacity in the metro to fulfill the quantity set. Returns false if there is not enough. + Available *bool `json:"available,omitempty"` + // The metro ID or code sent to check capacity. + Metro *string `json:"metro,omitempty"` + // The plan ID or slug sent to check capacity. + Plan *string `json:"plan,omitempty"` + // The number of servers sent to check capacity. + Quantity *string `json:"quantity,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CapacityCheckPerMetroInfo CapacityCheckPerMetroInfo + +// NewCapacityCheckPerMetroInfo instantiates a new CapacityCheckPerMetroInfo object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCapacityCheckPerMetroInfo() *CapacityCheckPerMetroInfo { + this := CapacityCheckPerMetroInfo{} + return &this +} + +// NewCapacityCheckPerMetroInfoWithDefaults instantiates a new CapacityCheckPerMetroInfo object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCapacityCheckPerMetroInfoWithDefaults() *CapacityCheckPerMetroInfo { + this := CapacityCheckPerMetroInfo{} + return &this +} + +// GetAvailable returns the Available field value if set, zero value otherwise. +func (o *CapacityCheckPerMetroInfo) GetAvailable() bool { + if o == nil || IsNil(o.Available) { + var ret bool + return ret + } + return *o.Available +} + +// GetAvailableOk returns a tuple with the Available field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityCheckPerMetroInfo) GetAvailableOk() (*bool, bool) { + if o == nil || IsNil(o.Available) { + return nil, false + } + return o.Available, true +} + +// HasAvailable returns a boolean if a field has been set. +func (o *CapacityCheckPerMetroInfo) HasAvailable() bool { + if o != nil && !IsNil(o.Available) { + return true + } + + return false +} + +// SetAvailable gets a reference to the given bool and assigns it to the Available field. +func (o *CapacityCheckPerMetroInfo) SetAvailable(v bool) { + o.Available = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *CapacityCheckPerMetroInfo) GetMetro() string { + if o == nil || IsNil(o.Metro) { + var ret string + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityCheckPerMetroInfo) GetMetroOk() (*string, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *CapacityCheckPerMetroInfo) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given string and assigns it to the Metro field. +func (o *CapacityCheckPerMetroInfo) SetMetro(v string) { + o.Metro = &v +} + +// GetPlan returns the Plan field value if set, zero value otherwise. +func (o *CapacityCheckPerMetroInfo) GetPlan() string { + if o == nil || IsNil(o.Plan) { + var ret string + return ret + } + return *o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityCheckPerMetroInfo) GetPlanOk() (*string, bool) { + if o == nil || IsNil(o.Plan) { + return nil, false + } + return o.Plan, true +} + +// HasPlan returns a boolean if a field has been set. +func (o *CapacityCheckPerMetroInfo) HasPlan() bool { + if o != nil && !IsNil(o.Plan) { + return true + } + + return false +} + +// SetPlan gets a reference to the given string and assigns it to the Plan field. +func (o *CapacityCheckPerMetroInfo) SetPlan(v string) { + o.Plan = &v +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *CapacityCheckPerMetroInfo) GetQuantity() string { + if o == nil || IsNil(o.Quantity) { + var ret string + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityCheckPerMetroInfo) GetQuantityOk() (*string, bool) { + if o == nil || IsNil(o.Quantity) { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *CapacityCheckPerMetroInfo) HasQuantity() bool { + if o != nil && !IsNil(o.Quantity) { + return true + } + + return false +} + +// SetQuantity gets a reference to the given string and assigns it to the Quantity field. +func (o *CapacityCheckPerMetroInfo) SetQuantity(v string) { + o.Quantity = &v +} + +func (o CapacityCheckPerMetroInfo) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CapacityCheckPerMetroInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Available) { + toSerialize["available"] = o.Available + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.Plan) { + toSerialize["plan"] = o.Plan + } + if !IsNil(o.Quantity) { + toSerialize["quantity"] = o.Quantity + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CapacityCheckPerMetroInfo) UnmarshalJSON(data []byte) (err error) { + varCapacityCheckPerMetroInfo := _CapacityCheckPerMetroInfo{} + + err = json.Unmarshal(data, &varCapacityCheckPerMetroInfo) + + if err != nil { + return err + } + + *o = CapacityCheckPerMetroInfo(varCapacityCheckPerMetroInfo) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "available") + delete(additionalProperties, "metro") + delete(additionalProperties, "plan") + delete(additionalProperties, "quantity") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCapacityCheckPerMetroInfo struct { + value *CapacityCheckPerMetroInfo + isSet bool +} + +func (v NullableCapacityCheckPerMetroInfo) Get() *CapacityCheckPerMetroInfo { + return v.value +} + +func (v *NullableCapacityCheckPerMetroInfo) Set(val *CapacityCheckPerMetroInfo) { + v.value = val + v.isSet = true +} + +func (v NullableCapacityCheckPerMetroInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableCapacityCheckPerMetroInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCapacityCheckPerMetroInfo(val *CapacityCheckPerMetroInfo) *NullableCapacityCheckPerMetroInfo { + return &NullableCapacityCheckPerMetroInfo{value: val, isSet: true} +} + +func (v NullableCapacityCheckPerMetroInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCapacityCheckPerMetroInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_metro_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_metro_list.go new file mode 100644 index 00000000..a7e49975 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_check_per_metro_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the CapacityCheckPerMetroList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CapacityCheckPerMetroList{} + +// CapacityCheckPerMetroList struct for CapacityCheckPerMetroList +type CapacityCheckPerMetroList struct { + Servers []CapacityCheckPerMetroInfo `json:"servers,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CapacityCheckPerMetroList CapacityCheckPerMetroList + +// NewCapacityCheckPerMetroList instantiates a new CapacityCheckPerMetroList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCapacityCheckPerMetroList() *CapacityCheckPerMetroList { + this := CapacityCheckPerMetroList{} + return &this +} + +// NewCapacityCheckPerMetroListWithDefaults instantiates a new CapacityCheckPerMetroList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCapacityCheckPerMetroListWithDefaults() *CapacityCheckPerMetroList { + this := CapacityCheckPerMetroList{} + return &this +} + +// GetServers returns the Servers field value if set, zero value otherwise. +func (o *CapacityCheckPerMetroList) GetServers() []CapacityCheckPerMetroInfo { + if o == nil || IsNil(o.Servers) { + var ret []CapacityCheckPerMetroInfo + return ret + } + return o.Servers +} + +// GetServersOk returns a tuple with the Servers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityCheckPerMetroList) GetServersOk() ([]CapacityCheckPerMetroInfo, bool) { + if o == nil || IsNil(o.Servers) { + return nil, false + } + return o.Servers, true +} + +// HasServers returns a boolean if a field has been set. +func (o *CapacityCheckPerMetroList) HasServers() bool { + if o != nil && !IsNil(o.Servers) { + return true + } + + return false +} + +// SetServers gets a reference to the given []CapacityCheckPerMetroInfo and assigns it to the Servers field. +func (o *CapacityCheckPerMetroList) SetServers(v []CapacityCheckPerMetroInfo) { + o.Servers = v +} + +func (o CapacityCheckPerMetroList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CapacityCheckPerMetroList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Servers) { + toSerialize["servers"] = o.Servers + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CapacityCheckPerMetroList) UnmarshalJSON(data []byte) (err error) { + varCapacityCheckPerMetroList := _CapacityCheckPerMetroList{} + + err = json.Unmarshal(data, &varCapacityCheckPerMetroList) + + if err != nil { + return err + } + + *o = CapacityCheckPerMetroList(varCapacityCheckPerMetroList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "servers") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCapacityCheckPerMetroList struct { + value *CapacityCheckPerMetroList + isSet bool +} + +func (v NullableCapacityCheckPerMetroList) Get() *CapacityCheckPerMetroList { + return v.value +} + +func (v *NullableCapacityCheckPerMetroList) Set(val *CapacityCheckPerMetroList) { + v.value = val + v.isSet = true +} + +func (v NullableCapacityCheckPerMetroList) IsSet() bool { + return v.isSet +} + +func (v *NullableCapacityCheckPerMetroList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCapacityCheckPerMetroList(val *CapacityCheckPerMetroList) *NullableCapacityCheckPerMetroList { + return &NullableCapacityCheckPerMetroList{value: val, isSet: true} +} + +func (v NullableCapacityCheckPerMetroList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCapacityCheckPerMetroList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_input.go new file mode 100644 index 00000000..83d2043c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_input.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the CapacityInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CapacityInput{} + +// CapacityInput struct for CapacityInput +type CapacityInput struct { + Servers []ServerInfo `json:"servers,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CapacityInput CapacityInput + +// NewCapacityInput instantiates a new CapacityInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCapacityInput() *CapacityInput { + this := CapacityInput{} + return &this +} + +// NewCapacityInputWithDefaults instantiates a new CapacityInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCapacityInputWithDefaults() *CapacityInput { + this := CapacityInput{} + return &this +} + +// GetServers returns the Servers field value if set, zero value otherwise. +func (o *CapacityInput) GetServers() []ServerInfo { + if o == nil || IsNil(o.Servers) { + var ret []ServerInfo + return ret + } + return o.Servers +} + +// GetServersOk returns a tuple with the Servers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityInput) GetServersOk() ([]ServerInfo, bool) { + if o == nil || IsNil(o.Servers) { + return nil, false + } + return o.Servers, true +} + +// HasServers returns a boolean if a field has been set. +func (o *CapacityInput) HasServers() bool { + if o != nil && !IsNil(o.Servers) { + return true + } + + return false +} + +// SetServers gets a reference to the given []ServerInfo and assigns it to the Servers field. +func (o *CapacityInput) SetServers(v []ServerInfo) { + o.Servers = v +} + +func (o CapacityInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CapacityInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Servers) { + toSerialize["servers"] = o.Servers + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CapacityInput) UnmarshalJSON(data []byte) (err error) { + varCapacityInput := _CapacityInput{} + + err = json.Unmarshal(data, &varCapacityInput) + + if err != nil { + return err + } + + *o = CapacityInput(varCapacityInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "servers") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCapacityInput struct { + value *CapacityInput + isSet bool +} + +func (v NullableCapacityInput) Get() *CapacityInput { + return v.value +} + +func (v *NullableCapacityInput) Set(val *CapacityInput) { + v.value = val + v.isSet = true +} + +func (v NullableCapacityInput) IsSet() bool { + return v.isSet +} + +func (v *NullableCapacityInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCapacityInput(val *CapacityInput) *NullableCapacityInput { + return &NullableCapacityInput{value: val, isSet: true} +} + +func (v NullableCapacityInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCapacityInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_level_per_baremetal.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_level_per_baremetal.go new file mode 100644 index 00000000..fb604991 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_level_per_baremetal.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the CapacityLevelPerBaremetal type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CapacityLevelPerBaremetal{} + +// CapacityLevelPerBaremetal struct for CapacityLevelPerBaremetal +type CapacityLevelPerBaremetal struct { + Level *string `json:"level,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CapacityLevelPerBaremetal CapacityLevelPerBaremetal + +// NewCapacityLevelPerBaremetal instantiates a new CapacityLevelPerBaremetal object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCapacityLevelPerBaremetal() *CapacityLevelPerBaremetal { + this := CapacityLevelPerBaremetal{} + return &this +} + +// NewCapacityLevelPerBaremetalWithDefaults instantiates a new CapacityLevelPerBaremetal object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCapacityLevelPerBaremetalWithDefaults() *CapacityLevelPerBaremetal { + this := CapacityLevelPerBaremetal{} + return &this +} + +// GetLevel returns the Level field value if set, zero value otherwise. +func (o *CapacityLevelPerBaremetal) GetLevel() string { + if o == nil || IsNil(o.Level) { + var ret string + return ret + } + return *o.Level +} + +// GetLevelOk returns a tuple with the Level field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityLevelPerBaremetal) GetLevelOk() (*string, bool) { + if o == nil || IsNil(o.Level) { + return nil, false + } + return o.Level, true +} + +// HasLevel returns a boolean if a field has been set. +func (o *CapacityLevelPerBaremetal) HasLevel() bool { + if o != nil && !IsNil(o.Level) { + return true + } + + return false +} + +// SetLevel gets a reference to the given string and assigns it to the Level field. +func (o *CapacityLevelPerBaremetal) SetLevel(v string) { + o.Level = &v +} + +func (o CapacityLevelPerBaremetal) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CapacityLevelPerBaremetal) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Level) { + toSerialize["level"] = o.Level + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CapacityLevelPerBaremetal) UnmarshalJSON(data []byte) (err error) { + varCapacityLevelPerBaremetal := _CapacityLevelPerBaremetal{} + + err = json.Unmarshal(data, &varCapacityLevelPerBaremetal) + + if err != nil { + return err + } + + *o = CapacityLevelPerBaremetal(varCapacityLevelPerBaremetal) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "level") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCapacityLevelPerBaremetal struct { + value *CapacityLevelPerBaremetal + isSet bool +} + +func (v NullableCapacityLevelPerBaremetal) Get() *CapacityLevelPerBaremetal { + return v.value +} + +func (v *NullableCapacityLevelPerBaremetal) Set(val *CapacityLevelPerBaremetal) { + v.value = val + v.isSet = true +} + +func (v NullableCapacityLevelPerBaremetal) IsSet() bool { + return v.isSet +} + +func (v *NullableCapacityLevelPerBaremetal) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCapacityLevelPerBaremetal(val *CapacityLevelPerBaremetal) *NullableCapacityLevelPerBaremetal { + return &NullableCapacityLevelPerBaremetal{value: val, isSet: true} +} + +func (v NullableCapacityLevelPerBaremetal) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCapacityLevelPerBaremetal) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_list.go new file mode 100644 index 00000000..be25aecc --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_capacity_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the CapacityList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CapacityList{} + +// CapacityList struct for CapacityList +type CapacityList struct { + Capacity *map[string]map[string]CapacityLevelPerBaremetal `json:"capacity,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CapacityList CapacityList + +// NewCapacityList instantiates a new CapacityList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCapacityList() *CapacityList { + this := CapacityList{} + return &this +} + +// NewCapacityListWithDefaults instantiates a new CapacityList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCapacityListWithDefaults() *CapacityList { + this := CapacityList{} + return &this +} + +// GetCapacity returns the Capacity field value if set, zero value otherwise. +func (o *CapacityList) GetCapacity() map[string]map[string]CapacityLevelPerBaremetal { + if o == nil || IsNil(o.Capacity) { + var ret map[string]map[string]CapacityLevelPerBaremetal + return ret + } + return *o.Capacity +} + +// GetCapacityOk returns a tuple with the Capacity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CapacityList) GetCapacityOk() (*map[string]map[string]CapacityLevelPerBaremetal, bool) { + if o == nil || IsNil(o.Capacity) { + return nil, false + } + return o.Capacity, true +} + +// HasCapacity returns a boolean if a field has been set. +func (o *CapacityList) HasCapacity() bool { + if o != nil && !IsNil(o.Capacity) { + return true + } + + return false +} + +// SetCapacity gets a reference to the given map[string]map[string]CapacityLevelPerBaremetal and assigns it to the Capacity field. +func (o *CapacityList) SetCapacity(v map[string]map[string]CapacityLevelPerBaremetal) { + o.Capacity = &v +} + +func (o CapacityList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CapacityList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Capacity) { + toSerialize["capacity"] = o.Capacity + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CapacityList) UnmarshalJSON(data []byte) (err error) { + varCapacityList := _CapacityList{} + + err = json.Unmarshal(data, &varCapacityList) + + if err != nil { + return err + } + + *o = CapacityList(varCapacityList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "capacity") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCapacityList struct { + value *CapacityList + isSet bool +} + +func (v NullableCapacityList) Get() *CapacityList { + return v.value +} + +func (v *NullableCapacityList) Set(val *CapacityList) { + v.value = val + v.isSet = true +} + +func (v NullableCapacityList) IsSet() bool { + return v.isSet +} + +func (v *NullableCapacityList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCapacityList(val *CapacityList) *NullableCapacityList { + return &NullableCapacityList{value: val, isSet: true} +} + +func (v NullableCapacityList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCapacityList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_component.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_component.go new file mode 100644 index 00000000..448befeb --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_component.go @@ -0,0 +1,536 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the Component type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Component{} + +// Component struct for Component +type Component struct { + // Component UUID + Uuid *string `json:"uuid,omitempty"` + // Component vendor + Vendor *string `json:"vendor,omitempty"` + // List of models where this component version can be applied + Model []string `json:"model,omitempty"` + // name of the file + Filename *string `json:"filename,omitempty"` + // Version of the component + Version *string `json:"version,omitempty"` + // Component type + Component *string `json:"component,omitempty"` + // File checksum + Checksum *string `json:"checksum,omitempty"` + // Location of the file + UpstreamUrl *string `json:"upstream_url,omitempty"` + // Location of the file in the repository + RepositoryUrl *string `json:"repository_url,omitempty"` + // Datetime when the block was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Datetime when the block was updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Component Component + +// NewComponent instantiates a new Component object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewComponent() *Component { + this := Component{} + return &this +} + +// NewComponentWithDefaults instantiates a new Component object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewComponentWithDefaults() *Component { + this := Component{} + return &this +} + +// GetUuid returns the Uuid field value if set, zero value otherwise. +func (o *Component) GetUuid() string { + if o == nil || IsNil(o.Uuid) { + var ret string + return ret + } + return *o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Component) GetUuidOk() (*string, bool) { + if o == nil || IsNil(o.Uuid) { + return nil, false + } + return o.Uuid, true +} + +// HasUuid returns a boolean if a field has been set. +func (o *Component) HasUuid() bool { + if o != nil && !IsNil(o.Uuid) { + return true + } + + return false +} + +// SetUuid gets a reference to the given string and assigns it to the Uuid field. +func (o *Component) SetUuid(v string) { + o.Uuid = &v +} + +// GetVendor returns the Vendor field value if set, zero value otherwise. +func (o *Component) GetVendor() string { + if o == nil || IsNil(o.Vendor) { + var ret string + return ret + } + return *o.Vendor +} + +// GetVendorOk returns a tuple with the Vendor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Component) GetVendorOk() (*string, bool) { + if o == nil || IsNil(o.Vendor) { + return nil, false + } + return o.Vendor, true +} + +// HasVendor returns a boolean if a field has been set. +func (o *Component) HasVendor() bool { + if o != nil && !IsNil(o.Vendor) { + return true + } + + return false +} + +// SetVendor gets a reference to the given string and assigns it to the Vendor field. +func (o *Component) SetVendor(v string) { + o.Vendor = &v +} + +// GetModel returns the Model field value if set, zero value otherwise. +func (o *Component) GetModel() []string { + if o == nil || IsNil(o.Model) { + var ret []string + return ret + } + return o.Model +} + +// GetModelOk returns a tuple with the Model field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Component) GetModelOk() ([]string, bool) { + if o == nil || IsNil(o.Model) { + return nil, false + } + return o.Model, true +} + +// HasModel returns a boolean if a field has been set. +func (o *Component) HasModel() bool { + if o != nil && !IsNil(o.Model) { + return true + } + + return false +} + +// SetModel gets a reference to the given []string and assigns it to the Model field. +func (o *Component) SetModel(v []string) { + o.Model = v +} + +// GetFilename returns the Filename field value if set, zero value otherwise. +func (o *Component) GetFilename() string { + if o == nil || IsNil(o.Filename) { + var ret string + return ret + } + return *o.Filename +} + +// GetFilenameOk returns a tuple with the Filename field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Component) GetFilenameOk() (*string, bool) { + if o == nil || IsNil(o.Filename) { + return nil, false + } + return o.Filename, true +} + +// HasFilename returns a boolean if a field has been set. +func (o *Component) HasFilename() bool { + if o != nil && !IsNil(o.Filename) { + return true + } + + return false +} + +// SetFilename gets a reference to the given string and assigns it to the Filename field. +func (o *Component) SetFilename(v string) { + o.Filename = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *Component) GetVersion() string { + if o == nil || IsNil(o.Version) { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Component) GetVersionOk() (*string, bool) { + if o == nil || IsNil(o.Version) { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *Component) HasVersion() bool { + if o != nil && !IsNil(o.Version) { + return true + } + + return false +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *Component) SetVersion(v string) { + o.Version = &v +} + +// GetComponent returns the Component field value if set, zero value otherwise. +func (o *Component) GetComponent() string { + if o == nil || IsNil(o.Component) { + var ret string + return ret + } + return *o.Component +} + +// GetComponentOk returns a tuple with the Component field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Component) GetComponentOk() (*string, bool) { + if o == nil || IsNil(o.Component) { + return nil, false + } + return o.Component, true +} + +// HasComponent returns a boolean if a field has been set. +func (o *Component) HasComponent() bool { + if o != nil && !IsNil(o.Component) { + return true + } + + return false +} + +// SetComponent gets a reference to the given string and assigns it to the Component field. +func (o *Component) SetComponent(v string) { + o.Component = &v +} + +// GetChecksum returns the Checksum field value if set, zero value otherwise. +func (o *Component) GetChecksum() string { + if o == nil || IsNil(o.Checksum) { + var ret string + return ret + } + return *o.Checksum +} + +// GetChecksumOk returns a tuple with the Checksum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Component) GetChecksumOk() (*string, bool) { + if o == nil || IsNil(o.Checksum) { + return nil, false + } + return o.Checksum, true +} + +// HasChecksum returns a boolean if a field has been set. +func (o *Component) HasChecksum() bool { + if o != nil && !IsNil(o.Checksum) { + return true + } + + return false +} + +// SetChecksum gets a reference to the given string and assigns it to the Checksum field. +func (o *Component) SetChecksum(v string) { + o.Checksum = &v +} + +// GetUpstreamUrl returns the UpstreamUrl field value if set, zero value otherwise. +func (o *Component) GetUpstreamUrl() string { + if o == nil || IsNil(o.UpstreamUrl) { + var ret string + return ret + } + return *o.UpstreamUrl +} + +// GetUpstreamUrlOk returns a tuple with the UpstreamUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Component) GetUpstreamUrlOk() (*string, bool) { + if o == nil || IsNil(o.UpstreamUrl) { + return nil, false + } + return o.UpstreamUrl, true +} + +// HasUpstreamUrl returns a boolean if a field has been set. +func (o *Component) HasUpstreamUrl() bool { + if o != nil && !IsNil(o.UpstreamUrl) { + return true + } + + return false +} + +// SetUpstreamUrl gets a reference to the given string and assigns it to the UpstreamUrl field. +func (o *Component) SetUpstreamUrl(v string) { + o.UpstreamUrl = &v +} + +// GetRepositoryUrl returns the RepositoryUrl field value if set, zero value otherwise. +func (o *Component) GetRepositoryUrl() string { + if o == nil || IsNil(o.RepositoryUrl) { + var ret string + return ret + } + return *o.RepositoryUrl +} + +// GetRepositoryUrlOk returns a tuple with the RepositoryUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Component) GetRepositoryUrlOk() (*string, bool) { + if o == nil || IsNil(o.RepositoryUrl) { + return nil, false + } + return o.RepositoryUrl, true +} + +// HasRepositoryUrl returns a boolean if a field has been set. +func (o *Component) HasRepositoryUrl() bool { + if o != nil && !IsNil(o.RepositoryUrl) { + return true + } + + return false +} + +// SetRepositoryUrl gets a reference to the given string and assigns it to the RepositoryUrl field. +func (o *Component) SetRepositoryUrl(v string) { + o.RepositoryUrl = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Component) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Component) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Component) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Component) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Component) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Component) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Component) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Component) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o Component) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Component) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Uuid) { + toSerialize["uuid"] = o.Uuid + } + if !IsNil(o.Vendor) { + toSerialize["vendor"] = o.Vendor + } + if !IsNil(o.Model) { + toSerialize["model"] = o.Model + } + if !IsNil(o.Filename) { + toSerialize["filename"] = o.Filename + } + if !IsNil(o.Version) { + toSerialize["version"] = o.Version + } + if !IsNil(o.Component) { + toSerialize["component"] = o.Component + } + if !IsNil(o.Checksum) { + toSerialize["checksum"] = o.Checksum + } + if !IsNil(o.UpstreamUrl) { + toSerialize["upstream_url"] = o.UpstreamUrl + } + if !IsNil(o.RepositoryUrl) { + toSerialize["repository_url"] = o.RepositoryUrl + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Component) UnmarshalJSON(data []byte) (err error) { + varComponent := _Component{} + + err = json.Unmarshal(data, &varComponent) + + if err != nil { + return err + } + + *o = Component(varComponent) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "uuid") + delete(additionalProperties, "vendor") + delete(additionalProperties, "model") + delete(additionalProperties, "filename") + delete(additionalProperties, "version") + delete(additionalProperties, "component") + delete(additionalProperties, "checksum") + delete(additionalProperties, "upstream_url") + delete(additionalProperties, "repository_url") + delete(additionalProperties, "created_at") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableComponent struct { + value *Component + isSet bool +} + +func (v NullableComponent) Get() *Component { + return v.value +} + +func (v *NullableComponent) Set(val *Component) { + v.value = val + v.isSet = true +} + +func (v NullableComponent) IsSet() bool { + return v.isSet +} + +func (v *NullableComponent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableComponent(val *Component) *NullableComponent { + return &NullableComponent{value: val, isSet: true} +} + +func (v NullableComponent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableComponent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_coordinates.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_coordinates.go new file mode 100644 index 00000000..e59bb9cc --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_coordinates.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Coordinates type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Coordinates{} + +// Coordinates struct for Coordinates +type Coordinates struct { + Latitude *string `json:"latitude,omitempty"` + Longitude *string `json:"longitude,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Coordinates Coordinates + +// NewCoordinates instantiates a new Coordinates object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCoordinates() *Coordinates { + this := Coordinates{} + return &this +} + +// NewCoordinatesWithDefaults instantiates a new Coordinates object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCoordinatesWithDefaults() *Coordinates { + this := Coordinates{} + return &this +} + +// GetLatitude returns the Latitude field value if set, zero value otherwise. +func (o *Coordinates) GetLatitude() string { + if o == nil || IsNil(o.Latitude) { + var ret string + return ret + } + return *o.Latitude +} + +// GetLatitudeOk returns a tuple with the Latitude field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Coordinates) GetLatitudeOk() (*string, bool) { + if o == nil || IsNil(o.Latitude) { + return nil, false + } + return o.Latitude, true +} + +// HasLatitude returns a boolean if a field has been set. +func (o *Coordinates) HasLatitude() bool { + if o != nil && !IsNil(o.Latitude) { + return true + } + + return false +} + +// SetLatitude gets a reference to the given string and assigns it to the Latitude field. +func (o *Coordinates) SetLatitude(v string) { + o.Latitude = &v +} + +// GetLongitude returns the Longitude field value if set, zero value otherwise. +func (o *Coordinates) GetLongitude() string { + if o == nil || IsNil(o.Longitude) { + var ret string + return ret + } + return *o.Longitude +} + +// GetLongitudeOk returns a tuple with the Longitude field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Coordinates) GetLongitudeOk() (*string, bool) { + if o == nil || IsNil(o.Longitude) { + return nil, false + } + return o.Longitude, true +} + +// HasLongitude returns a boolean if a field has been set. +func (o *Coordinates) HasLongitude() bool { + if o != nil && !IsNil(o.Longitude) { + return true + } + + return false +} + +// SetLongitude gets a reference to the given string and assigns it to the Longitude field. +func (o *Coordinates) SetLongitude(v string) { + o.Longitude = &v +} + +func (o Coordinates) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Coordinates) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Latitude) { + toSerialize["latitude"] = o.Latitude + } + if !IsNil(o.Longitude) { + toSerialize["longitude"] = o.Longitude + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Coordinates) UnmarshalJSON(data []byte) (err error) { + varCoordinates := _Coordinates{} + + err = json.Unmarshal(data, &varCoordinates) + + if err != nil { + return err + } + + *o = Coordinates(varCoordinates) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "latitude") + delete(additionalProperties, "longitude") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCoordinates struct { + value *Coordinates + isSet bool +} + +func (v NullableCoordinates) Get() *Coordinates { + return v.value +} + +func (v *NullableCoordinates) Set(val *Coordinates) { + v.value = val + v.isSet = true +} + +func (v NullableCoordinates) IsSet() bool { + return v.isSet +} + +func (v *NullableCoordinates) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCoordinates(val *Coordinates) *NullableCoordinates { + return &NullableCoordinates{value: val, isSet: true} +} + +func (v NullableCoordinates) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCoordinates) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_device_request.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_device_request.go new file mode 100644 index 00000000..187d4365 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_device_request.go @@ -0,0 +1,146 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// CreateDeviceRequest - struct for CreateDeviceRequest +type CreateDeviceRequest struct { + DeviceCreateInFacilityInput *DeviceCreateInFacilityInput + DeviceCreateInMetroInput *DeviceCreateInMetroInput +} + +// DeviceCreateInFacilityInputAsCreateDeviceRequest is a convenience function that returns DeviceCreateInFacilityInput wrapped in CreateDeviceRequest +func DeviceCreateInFacilityInputAsCreateDeviceRequest(v *DeviceCreateInFacilityInput) CreateDeviceRequest { + return CreateDeviceRequest{ + DeviceCreateInFacilityInput: v, + } +} + +// DeviceCreateInMetroInputAsCreateDeviceRequest is a convenience function that returns DeviceCreateInMetroInput wrapped in CreateDeviceRequest +func DeviceCreateInMetroInputAsCreateDeviceRequest(v *DeviceCreateInMetroInput) CreateDeviceRequest { + return CreateDeviceRequest{ + DeviceCreateInMetroInput: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateDeviceRequest) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into DeviceCreateInFacilityInput + err = newStrictDecoder(data).Decode(&dst.DeviceCreateInFacilityInput) + if err == nil { + jsonDeviceCreateInFacilityInput, _ := json.Marshal(dst.DeviceCreateInFacilityInput) + if string(jsonDeviceCreateInFacilityInput) == "{}" { // empty struct + dst.DeviceCreateInFacilityInput = nil + } else { + match++ + } + } else { + dst.DeviceCreateInFacilityInput = nil + } + + // try to unmarshal data into DeviceCreateInMetroInput + err = newStrictDecoder(data).Decode(&dst.DeviceCreateInMetroInput) + if err == nil { + jsonDeviceCreateInMetroInput, _ := json.Marshal(dst.DeviceCreateInMetroInput) + if string(jsonDeviceCreateInMetroInput) == "{}" { // empty struct + dst.DeviceCreateInMetroInput = nil + } else { + match++ + } + } else { + dst.DeviceCreateInMetroInput = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.DeviceCreateInFacilityInput = nil + dst.DeviceCreateInMetroInput = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateDeviceRequest)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateDeviceRequest)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateDeviceRequest) MarshalJSON() ([]byte, error) { + if src.DeviceCreateInFacilityInput != nil { + return json.Marshal(&src.DeviceCreateInFacilityInput) + } + + if src.DeviceCreateInMetroInput != nil { + return json.Marshal(&src.DeviceCreateInMetroInput) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *CreateDeviceRequest) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.DeviceCreateInFacilityInput != nil { + return obj.DeviceCreateInFacilityInput + } + + if obj.DeviceCreateInMetroInput != nil { + return obj.DeviceCreateInMetroInput + } + + // all schemas are nil + return nil +} + +type NullableCreateDeviceRequest struct { + value *CreateDeviceRequest + isSet bool +} + +func (v NullableCreateDeviceRequest) Get() *CreateDeviceRequest { + return v.value +} + +func (v *NullableCreateDeviceRequest) Set(val *CreateDeviceRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDeviceRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDeviceRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDeviceRequest(val *CreateDeviceRequest) *NullableCreateDeviceRequest { + return &NullableCreateDeviceRequest{value: val, isSet: true} +} + +func (v NullableCreateDeviceRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDeviceRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_email_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_email_input.go new file mode 100644 index 00000000..408c755e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_email_input.go @@ -0,0 +1,167 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateEmailInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateEmailInput{} + +// CreateEmailInput struct for CreateEmailInput +type CreateEmailInput struct { + Address string `json:"address"` + AdditionalProperties map[string]interface{} +} + +type _CreateEmailInput CreateEmailInput + +// NewCreateEmailInput instantiates a new CreateEmailInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateEmailInput(address string) *CreateEmailInput { + this := CreateEmailInput{} + this.Address = address + return &this +} + +// NewCreateEmailInputWithDefaults instantiates a new CreateEmailInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateEmailInputWithDefaults() *CreateEmailInput { + this := CreateEmailInput{} + return &this +} + +// GetAddress returns the Address field value +func (o *CreateEmailInput) GetAddress() string { + if o == nil { + var ret string + return ret + } + + return o.Address +} + +// GetAddressOk returns a tuple with the Address field value +// and a boolean to check if the value has been set. +func (o *CreateEmailInput) GetAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Address, true +} + +// SetAddress sets field value +func (o *CreateEmailInput) SetAddress(v string) { + o.Address = v +} + +func (o CreateEmailInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateEmailInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["address"] = o.Address + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateEmailInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "address", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateEmailInput := _CreateEmailInput{} + + err = json.Unmarshal(data, &varCreateEmailInput) + + if err != nil { + return err + } + + *o = CreateEmailInput(varCreateEmailInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateEmailInput struct { + value *CreateEmailInput + isSet bool +} + +func (v NullableCreateEmailInput) Get() *CreateEmailInput { + return v.value +} + +func (v *NullableCreateEmailInput) Set(val *CreateEmailInput) { + v.value = val + v.isSet = true +} + +func (v NullableCreateEmailInput) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateEmailInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateEmailInput(val *CreateEmailInput) *NullableCreateEmailInput { + return &NullableCreateEmailInput{value: val, isSet: true} +} + +func (v NullableCreateEmailInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateEmailInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_metal_gateway_request.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_metal_gateway_request.go new file mode 100644 index 00000000..f285af00 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_metal_gateway_request.go @@ -0,0 +1,146 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// CreateMetalGatewayRequest - struct for CreateMetalGatewayRequest +type CreateMetalGatewayRequest struct { + MetalGatewayCreateInput *MetalGatewayCreateInput + VrfMetalGatewayCreateInput *VrfMetalGatewayCreateInput +} + +// MetalGatewayCreateInputAsCreateMetalGatewayRequest is a convenience function that returns MetalGatewayCreateInput wrapped in CreateMetalGatewayRequest +func MetalGatewayCreateInputAsCreateMetalGatewayRequest(v *MetalGatewayCreateInput) CreateMetalGatewayRequest { + return CreateMetalGatewayRequest{ + MetalGatewayCreateInput: v, + } +} + +// VrfMetalGatewayCreateInputAsCreateMetalGatewayRequest is a convenience function that returns VrfMetalGatewayCreateInput wrapped in CreateMetalGatewayRequest +func VrfMetalGatewayCreateInputAsCreateMetalGatewayRequest(v *VrfMetalGatewayCreateInput) CreateMetalGatewayRequest { + return CreateMetalGatewayRequest{ + VrfMetalGatewayCreateInput: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateMetalGatewayRequest) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into MetalGatewayCreateInput + err = newStrictDecoder(data).Decode(&dst.MetalGatewayCreateInput) + if err == nil { + jsonMetalGatewayCreateInput, _ := json.Marshal(dst.MetalGatewayCreateInput) + if string(jsonMetalGatewayCreateInput) == "{}" { // empty struct + dst.MetalGatewayCreateInput = nil + } else { + match++ + } + } else { + dst.MetalGatewayCreateInput = nil + } + + // try to unmarshal data into VrfMetalGatewayCreateInput + err = newStrictDecoder(data).Decode(&dst.VrfMetalGatewayCreateInput) + if err == nil { + jsonVrfMetalGatewayCreateInput, _ := json.Marshal(dst.VrfMetalGatewayCreateInput) + if string(jsonVrfMetalGatewayCreateInput) == "{}" { // empty struct + dst.VrfMetalGatewayCreateInput = nil + } else { + match++ + } + } else { + dst.VrfMetalGatewayCreateInput = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.MetalGatewayCreateInput = nil + dst.VrfMetalGatewayCreateInput = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateMetalGatewayRequest)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateMetalGatewayRequest)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateMetalGatewayRequest) MarshalJSON() ([]byte, error) { + if src.MetalGatewayCreateInput != nil { + return json.Marshal(&src.MetalGatewayCreateInput) + } + + if src.VrfMetalGatewayCreateInput != nil { + return json.Marshal(&src.VrfMetalGatewayCreateInput) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *CreateMetalGatewayRequest) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.MetalGatewayCreateInput != nil { + return obj.MetalGatewayCreateInput + } + + if obj.VrfMetalGatewayCreateInput != nil { + return obj.VrfMetalGatewayCreateInput + } + + // all schemas are nil + return nil +} + +type NullableCreateMetalGatewayRequest struct { + value *CreateMetalGatewayRequest + isSet bool +} + +func (v NullableCreateMetalGatewayRequest) Get() *CreateMetalGatewayRequest { + return v.value +} + +func (v *NullableCreateMetalGatewayRequest) Set(val *CreateMetalGatewayRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateMetalGatewayRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateMetalGatewayRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateMetalGatewayRequest(val *CreateMetalGatewayRequest) *NullableCreateMetalGatewayRequest { + return &NullableCreateMetalGatewayRequest{value: val, isSet: true} +} + +func (v NullableCreateMetalGatewayRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateMetalGatewayRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_organization_interconnection_request.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_organization_interconnection_request.go new file mode 100644 index 00000000..5acb16ae --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_organization_interconnection_request.go @@ -0,0 +1,176 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// CreateOrganizationInterconnectionRequest - struct for CreateOrganizationInterconnectionRequest +type CreateOrganizationInterconnectionRequest struct { + DedicatedPortCreateInput *DedicatedPortCreateInput + VlanFabricVcCreateInput *VlanFabricVcCreateInput + VrfFabricVcCreateInput *VrfFabricVcCreateInput +} + +// DedicatedPortCreateInputAsCreateOrganizationInterconnectionRequest is a convenience function that returns DedicatedPortCreateInput wrapped in CreateOrganizationInterconnectionRequest +func DedicatedPortCreateInputAsCreateOrganizationInterconnectionRequest(v *DedicatedPortCreateInput) CreateOrganizationInterconnectionRequest { + return CreateOrganizationInterconnectionRequest{ + DedicatedPortCreateInput: v, + } +} + +// VlanFabricVcCreateInputAsCreateOrganizationInterconnectionRequest is a convenience function that returns VlanFabricVcCreateInput wrapped in CreateOrganizationInterconnectionRequest +func VlanFabricVcCreateInputAsCreateOrganizationInterconnectionRequest(v *VlanFabricVcCreateInput) CreateOrganizationInterconnectionRequest { + return CreateOrganizationInterconnectionRequest{ + VlanFabricVcCreateInput: v, + } +} + +// VrfFabricVcCreateInputAsCreateOrganizationInterconnectionRequest is a convenience function that returns VrfFabricVcCreateInput wrapped in CreateOrganizationInterconnectionRequest +func VrfFabricVcCreateInputAsCreateOrganizationInterconnectionRequest(v *VrfFabricVcCreateInput) CreateOrganizationInterconnectionRequest { + return CreateOrganizationInterconnectionRequest{ + VrfFabricVcCreateInput: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateOrganizationInterconnectionRequest) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into DedicatedPortCreateInput + err = newStrictDecoder(data).Decode(&dst.DedicatedPortCreateInput) + if err == nil { + jsonDedicatedPortCreateInput, _ := json.Marshal(dst.DedicatedPortCreateInput) + if string(jsonDedicatedPortCreateInput) == "{}" { // empty struct + dst.DedicatedPortCreateInput = nil + } else { + match++ + } + } else { + dst.DedicatedPortCreateInput = nil + } + + // try to unmarshal data into VlanFabricVcCreateInput + err = newStrictDecoder(data).Decode(&dst.VlanFabricVcCreateInput) + if err == nil { + jsonVlanFabricVcCreateInput, _ := json.Marshal(dst.VlanFabricVcCreateInput) + if string(jsonVlanFabricVcCreateInput) == "{}" { // empty struct + dst.VlanFabricVcCreateInput = nil + } else { + match++ + } + } else { + dst.VlanFabricVcCreateInput = nil + } + + // try to unmarshal data into VrfFabricVcCreateInput + err = newStrictDecoder(data).Decode(&dst.VrfFabricVcCreateInput) + if err == nil { + jsonVrfFabricVcCreateInput, _ := json.Marshal(dst.VrfFabricVcCreateInput) + if string(jsonVrfFabricVcCreateInput) == "{}" { // empty struct + dst.VrfFabricVcCreateInput = nil + } else { + match++ + } + } else { + dst.VrfFabricVcCreateInput = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.DedicatedPortCreateInput = nil + dst.VlanFabricVcCreateInput = nil + dst.VrfFabricVcCreateInput = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateOrganizationInterconnectionRequest)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateOrganizationInterconnectionRequest)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateOrganizationInterconnectionRequest) MarshalJSON() ([]byte, error) { + if src.DedicatedPortCreateInput != nil { + return json.Marshal(&src.DedicatedPortCreateInput) + } + + if src.VlanFabricVcCreateInput != nil { + return json.Marshal(&src.VlanFabricVcCreateInput) + } + + if src.VrfFabricVcCreateInput != nil { + return json.Marshal(&src.VrfFabricVcCreateInput) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *CreateOrganizationInterconnectionRequest) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.DedicatedPortCreateInput != nil { + return obj.DedicatedPortCreateInput + } + + if obj.VlanFabricVcCreateInput != nil { + return obj.VlanFabricVcCreateInput + } + + if obj.VrfFabricVcCreateInput != nil { + return obj.VrfFabricVcCreateInput + } + + // all schemas are nil + return nil +} + +type NullableCreateOrganizationInterconnectionRequest struct { + value *CreateOrganizationInterconnectionRequest + isSet bool +} + +func (v NullableCreateOrganizationInterconnectionRequest) Get() *CreateOrganizationInterconnectionRequest { + return v.value +} + +func (v *NullableCreateOrganizationInterconnectionRequest) Set(val *CreateOrganizationInterconnectionRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateOrganizationInterconnectionRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateOrganizationInterconnectionRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateOrganizationInterconnectionRequest(val *CreateOrganizationInterconnectionRequest) *NullableCreateOrganizationInterconnectionRequest { + return &NullableCreateOrganizationInterconnectionRequest{value: val, isSet: true} +} + +func (v NullableCreateOrganizationInterconnectionRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateOrganizationInterconnectionRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request.go new file mode 100644 index 00000000..ba0bc364 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request.go @@ -0,0 +1,266 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the CreateSelfServiceReservationRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSelfServiceReservationRequest{} + +// CreateSelfServiceReservationRequest struct for CreateSelfServiceReservationRequest +type CreateSelfServiceReservationRequest struct { + Item []SelfServiceReservationItemRequest `json:"item,omitempty"` + Notes *string `json:"notes,omitempty"` + Period *CreateSelfServiceReservationRequestPeriod `json:"period,omitempty"` + StartDate *time.Time `json:"start_date,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateSelfServiceReservationRequest CreateSelfServiceReservationRequest + +// NewCreateSelfServiceReservationRequest instantiates a new CreateSelfServiceReservationRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateSelfServiceReservationRequest() *CreateSelfServiceReservationRequest { + this := CreateSelfServiceReservationRequest{} + return &this +} + +// NewCreateSelfServiceReservationRequestWithDefaults instantiates a new CreateSelfServiceReservationRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateSelfServiceReservationRequestWithDefaults() *CreateSelfServiceReservationRequest { + this := CreateSelfServiceReservationRequest{} + return &this +} + +// GetItem returns the Item field value if set, zero value otherwise. +func (o *CreateSelfServiceReservationRequest) GetItem() []SelfServiceReservationItemRequest { + if o == nil || IsNil(o.Item) { + var ret []SelfServiceReservationItemRequest + return ret + } + return o.Item +} + +// GetItemOk returns a tuple with the Item field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSelfServiceReservationRequest) GetItemOk() ([]SelfServiceReservationItemRequest, bool) { + if o == nil || IsNil(o.Item) { + return nil, false + } + return o.Item, true +} + +// HasItem returns a boolean if a field has been set. +func (o *CreateSelfServiceReservationRequest) HasItem() bool { + if o != nil && !IsNil(o.Item) { + return true + } + + return false +} + +// SetItem gets a reference to the given []SelfServiceReservationItemRequest and assigns it to the Item field. +func (o *CreateSelfServiceReservationRequest) SetItem(v []SelfServiceReservationItemRequest) { + o.Item = v +} + +// GetNotes returns the Notes field value if set, zero value otherwise. +func (o *CreateSelfServiceReservationRequest) GetNotes() string { + if o == nil || IsNil(o.Notes) { + var ret string + return ret + } + return *o.Notes +} + +// GetNotesOk returns a tuple with the Notes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSelfServiceReservationRequest) GetNotesOk() (*string, bool) { + if o == nil || IsNil(o.Notes) { + return nil, false + } + return o.Notes, true +} + +// HasNotes returns a boolean if a field has been set. +func (o *CreateSelfServiceReservationRequest) HasNotes() bool { + if o != nil && !IsNil(o.Notes) { + return true + } + + return false +} + +// SetNotes gets a reference to the given string and assigns it to the Notes field. +func (o *CreateSelfServiceReservationRequest) SetNotes(v string) { + o.Notes = &v +} + +// GetPeriod returns the Period field value if set, zero value otherwise. +func (o *CreateSelfServiceReservationRequest) GetPeriod() CreateSelfServiceReservationRequestPeriod { + if o == nil || IsNil(o.Period) { + var ret CreateSelfServiceReservationRequestPeriod + return ret + } + return *o.Period +} + +// GetPeriodOk returns a tuple with the Period field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSelfServiceReservationRequest) GetPeriodOk() (*CreateSelfServiceReservationRequestPeriod, bool) { + if o == nil || IsNil(o.Period) { + return nil, false + } + return o.Period, true +} + +// HasPeriod returns a boolean if a field has been set. +func (o *CreateSelfServiceReservationRequest) HasPeriod() bool { + if o != nil && !IsNil(o.Period) { + return true + } + + return false +} + +// SetPeriod gets a reference to the given CreateSelfServiceReservationRequestPeriod and assigns it to the Period field. +func (o *CreateSelfServiceReservationRequest) SetPeriod(v CreateSelfServiceReservationRequestPeriod) { + o.Period = &v +} + +// GetStartDate returns the StartDate field value if set, zero value otherwise. +func (o *CreateSelfServiceReservationRequest) GetStartDate() time.Time { + if o == nil || IsNil(o.StartDate) { + var ret time.Time + return ret + } + return *o.StartDate +} + +// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSelfServiceReservationRequest) GetStartDateOk() (*time.Time, bool) { + if o == nil || IsNil(o.StartDate) { + return nil, false + } + return o.StartDate, true +} + +// HasStartDate returns a boolean if a field has been set. +func (o *CreateSelfServiceReservationRequest) HasStartDate() bool { + if o != nil && !IsNil(o.StartDate) { + return true + } + + return false +} + +// SetStartDate gets a reference to the given time.Time and assigns it to the StartDate field. +func (o *CreateSelfServiceReservationRequest) SetStartDate(v time.Time) { + o.StartDate = &v +} + +func (o CreateSelfServiceReservationRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateSelfServiceReservationRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Item) { + toSerialize["item"] = o.Item + } + if !IsNil(o.Notes) { + toSerialize["notes"] = o.Notes + } + if !IsNil(o.Period) { + toSerialize["period"] = o.Period + } + if !IsNil(o.StartDate) { + toSerialize["start_date"] = o.StartDate + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateSelfServiceReservationRequest) UnmarshalJSON(data []byte) (err error) { + varCreateSelfServiceReservationRequest := _CreateSelfServiceReservationRequest{} + + err = json.Unmarshal(data, &varCreateSelfServiceReservationRequest) + + if err != nil { + return err + } + + *o = CreateSelfServiceReservationRequest(varCreateSelfServiceReservationRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "item") + delete(additionalProperties, "notes") + delete(additionalProperties, "period") + delete(additionalProperties, "start_date") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateSelfServiceReservationRequest struct { + value *CreateSelfServiceReservationRequest + isSet bool +} + +func (v NullableCreateSelfServiceReservationRequest) Get() *CreateSelfServiceReservationRequest { + return v.value +} + +func (v *NullableCreateSelfServiceReservationRequest) Set(val *CreateSelfServiceReservationRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSelfServiceReservationRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSelfServiceReservationRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSelfServiceReservationRequest(val *CreateSelfServiceReservationRequest) *NullableCreateSelfServiceReservationRequest { + return &NullableCreateSelfServiceReservationRequest{value: val, isSet: true} +} + +func (v NullableCreateSelfServiceReservationRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSelfServiceReservationRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period.go new file mode 100644 index 00000000..c57f994c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the CreateSelfServiceReservationRequestPeriod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSelfServiceReservationRequestPeriod{} + +// CreateSelfServiceReservationRequestPeriod struct for CreateSelfServiceReservationRequestPeriod +type CreateSelfServiceReservationRequestPeriod struct { + Count *CreateSelfServiceReservationRequestPeriodCount `json:"count,omitempty"` + Unit *CreateSelfServiceReservationRequestPeriodUnit `json:"unit,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateSelfServiceReservationRequestPeriod CreateSelfServiceReservationRequestPeriod + +// NewCreateSelfServiceReservationRequestPeriod instantiates a new CreateSelfServiceReservationRequestPeriod object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateSelfServiceReservationRequestPeriod() *CreateSelfServiceReservationRequestPeriod { + this := CreateSelfServiceReservationRequestPeriod{} + return &this +} + +// NewCreateSelfServiceReservationRequestPeriodWithDefaults instantiates a new CreateSelfServiceReservationRequestPeriod object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateSelfServiceReservationRequestPeriodWithDefaults() *CreateSelfServiceReservationRequestPeriod { + this := CreateSelfServiceReservationRequestPeriod{} + return &this +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *CreateSelfServiceReservationRequestPeriod) GetCount() CreateSelfServiceReservationRequestPeriodCount { + if o == nil || IsNil(o.Count) { + var ret CreateSelfServiceReservationRequestPeriodCount + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSelfServiceReservationRequestPeriod) GetCountOk() (*CreateSelfServiceReservationRequestPeriodCount, bool) { + if o == nil || IsNil(o.Count) { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *CreateSelfServiceReservationRequestPeriod) HasCount() bool { + if o != nil && !IsNil(o.Count) { + return true + } + + return false +} + +// SetCount gets a reference to the given CreateSelfServiceReservationRequestPeriodCount and assigns it to the Count field. +func (o *CreateSelfServiceReservationRequestPeriod) SetCount(v CreateSelfServiceReservationRequestPeriodCount) { + o.Count = &v +} + +// GetUnit returns the Unit field value if set, zero value otherwise. +func (o *CreateSelfServiceReservationRequestPeriod) GetUnit() CreateSelfServiceReservationRequestPeriodUnit { + if o == nil || IsNil(o.Unit) { + var ret CreateSelfServiceReservationRequestPeriodUnit + return ret + } + return *o.Unit +} + +// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSelfServiceReservationRequestPeriod) GetUnitOk() (*CreateSelfServiceReservationRequestPeriodUnit, bool) { + if o == nil || IsNil(o.Unit) { + return nil, false + } + return o.Unit, true +} + +// HasUnit returns a boolean if a field has been set. +func (o *CreateSelfServiceReservationRequestPeriod) HasUnit() bool { + if o != nil && !IsNil(o.Unit) { + return true + } + + return false +} + +// SetUnit gets a reference to the given CreateSelfServiceReservationRequestPeriodUnit and assigns it to the Unit field. +func (o *CreateSelfServiceReservationRequestPeriod) SetUnit(v CreateSelfServiceReservationRequestPeriodUnit) { + o.Unit = &v +} + +func (o CreateSelfServiceReservationRequestPeriod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateSelfServiceReservationRequestPeriod) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Count) { + toSerialize["count"] = o.Count + } + if !IsNil(o.Unit) { + toSerialize["unit"] = o.Unit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateSelfServiceReservationRequestPeriod) UnmarshalJSON(data []byte) (err error) { + varCreateSelfServiceReservationRequestPeriod := _CreateSelfServiceReservationRequestPeriod{} + + err = json.Unmarshal(data, &varCreateSelfServiceReservationRequestPeriod) + + if err != nil { + return err + } + + *o = CreateSelfServiceReservationRequestPeriod(varCreateSelfServiceReservationRequestPeriod) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "count") + delete(additionalProperties, "unit") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateSelfServiceReservationRequestPeriod struct { + value *CreateSelfServiceReservationRequestPeriod + isSet bool +} + +func (v NullableCreateSelfServiceReservationRequestPeriod) Get() *CreateSelfServiceReservationRequestPeriod { + return v.value +} + +func (v *NullableCreateSelfServiceReservationRequestPeriod) Set(val *CreateSelfServiceReservationRequestPeriod) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSelfServiceReservationRequestPeriod) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSelfServiceReservationRequestPeriod) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSelfServiceReservationRequestPeriod(val *CreateSelfServiceReservationRequestPeriod) *NullableCreateSelfServiceReservationRequestPeriod { + return &NullableCreateSelfServiceReservationRequestPeriod{value: val, isSet: true} +} + +func (v NullableCreateSelfServiceReservationRequestPeriod) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSelfServiceReservationRequestPeriod) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period_count.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period_count.go new file mode 100644 index 00000000..7eddfb5b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period_count.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// CreateSelfServiceReservationRequestPeriodCount the model 'CreateSelfServiceReservationRequestPeriodCount' +type CreateSelfServiceReservationRequestPeriodCount int32 + +// List of CreateSelfServiceReservationRequest_period_count +const ( + CREATESELFSERVICERESERVATIONREQUESTPERIODCOUNT__12 CreateSelfServiceReservationRequestPeriodCount = 12 + CREATESELFSERVICERESERVATIONREQUESTPERIODCOUNT__36 CreateSelfServiceReservationRequestPeriodCount = 36 +) + +// All allowed values of CreateSelfServiceReservationRequestPeriodCount enum +var AllowedCreateSelfServiceReservationRequestPeriodCountEnumValues = []CreateSelfServiceReservationRequestPeriodCount{ + 12, + 36, +} + +func (v *CreateSelfServiceReservationRequestPeriodCount) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := CreateSelfServiceReservationRequestPeriodCount(value) + for _, existing := range AllowedCreateSelfServiceReservationRequestPeriodCountEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateSelfServiceReservationRequestPeriodCount", value) +} + +// NewCreateSelfServiceReservationRequestPeriodCountFromValue returns a pointer to a valid CreateSelfServiceReservationRequestPeriodCount +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateSelfServiceReservationRequestPeriodCountFromValue(v int32) (*CreateSelfServiceReservationRequestPeriodCount, error) { + ev := CreateSelfServiceReservationRequestPeriodCount(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateSelfServiceReservationRequestPeriodCount: valid values are %v", v, AllowedCreateSelfServiceReservationRequestPeriodCountEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateSelfServiceReservationRequestPeriodCount) IsValid() bool { + for _, existing := range AllowedCreateSelfServiceReservationRequestPeriodCountEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CreateSelfServiceReservationRequest_period_count value +func (v CreateSelfServiceReservationRequestPeriodCount) Ptr() *CreateSelfServiceReservationRequestPeriodCount { + return &v +} + +type NullableCreateSelfServiceReservationRequestPeriodCount struct { + value *CreateSelfServiceReservationRequestPeriodCount + isSet bool +} + +func (v NullableCreateSelfServiceReservationRequestPeriodCount) Get() *CreateSelfServiceReservationRequestPeriodCount { + return v.value +} + +func (v *NullableCreateSelfServiceReservationRequestPeriodCount) Set(val *CreateSelfServiceReservationRequestPeriodCount) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSelfServiceReservationRequestPeriodCount) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSelfServiceReservationRequestPeriodCount) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSelfServiceReservationRequestPeriodCount(val *CreateSelfServiceReservationRequestPeriodCount) *NullableCreateSelfServiceReservationRequestPeriodCount { + return &NullableCreateSelfServiceReservationRequestPeriodCount{value: val, isSet: true} +} + +func (v NullableCreateSelfServiceReservationRequestPeriodCount) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSelfServiceReservationRequestPeriodCount) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period_unit.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period_unit.go new file mode 100644 index 00000000..c47856b5 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_create_self_service_reservation_request_period_unit.go @@ -0,0 +1,109 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// CreateSelfServiceReservationRequestPeriodUnit the model 'CreateSelfServiceReservationRequestPeriodUnit' +type CreateSelfServiceReservationRequestPeriodUnit string + +// List of CreateSelfServiceReservationRequest_period_unit +const ( + CREATESELFSERVICERESERVATIONREQUESTPERIODUNIT_MONTHLY CreateSelfServiceReservationRequestPeriodUnit = "monthly" +) + +// All allowed values of CreateSelfServiceReservationRequestPeriodUnit enum +var AllowedCreateSelfServiceReservationRequestPeriodUnitEnumValues = []CreateSelfServiceReservationRequestPeriodUnit{ + "monthly", +} + +func (v *CreateSelfServiceReservationRequestPeriodUnit) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := CreateSelfServiceReservationRequestPeriodUnit(value) + for _, existing := range AllowedCreateSelfServiceReservationRequestPeriodUnitEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateSelfServiceReservationRequestPeriodUnit", value) +} + +// NewCreateSelfServiceReservationRequestPeriodUnitFromValue returns a pointer to a valid CreateSelfServiceReservationRequestPeriodUnit +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateSelfServiceReservationRequestPeriodUnitFromValue(v string) (*CreateSelfServiceReservationRequestPeriodUnit, error) { + ev := CreateSelfServiceReservationRequestPeriodUnit(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateSelfServiceReservationRequestPeriodUnit: valid values are %v", v, AllowedCreateSelfServiceReservationRequestPeriodUnitEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateSelfServiceReservationRequestPeriodUnit) IsValid() bool { + for _, existing := range AllowedCreateSelfServiceReservationRequestPeriodUnitEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CreateSelfServiceReservationRequest_period_unit value +func (v CreateSelfServiceReservationRequestPeriodUnit) Ptr() *CreateSelfServiceReservationRequestPeriodUnit { + return &v +} + +type NullableCreateSelfServiceReservationRequestPeriodUnit struct { + value *CreateSelfServiceReservationRequestPeriodUnit + isSet bool +} + +func (v NullableCreateSelfServiceReservationRequestPeriodUnit) Get() *CreateSelfServiceReservationRequestPeriodUnit { + return v.value +} + +func (v *NullableCreateSelfServiceReservationRequestPeriodUnit) Set(val *CreateSelfServiceReservationRequestPeriodUnit) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSelfServiceReservationRequestPeriodUnit) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSelfServiceReservationRequestPeriodUnit) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSelfServiceReservationRequestPeriodUnit(val *CreateSelfServiceReservationRequestPeriodUnit) *NullableCreateSelfServiceReservationRequestPeriodUnit { + return &NullableCreateSelfServiceReservationRequestPeriodUnit{value: val, isSet: true} +} + +func (v NullableCreateSelfServiceReservationRequestPeriodUnit) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSelfServiceReservationRequestPeriodUnit) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input.go new file mode 100644 index 00000000..fb429f36 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input.go @@ -0,0 +1,556 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the DedicatedPortCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DedicatedPortCreateInput{} + +// DedicatedPortCreateInput struct for DedicatedPortCreateInput +type DedicatedPortCreateInput struct { + // The billing account name of the Equinix Fabric account. + BillingAccountName *string `json:"billing_account_name,omitempty"` + // The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key. + ContactEmail *string `json:"contact_email,omitempty"` + Description *string `json:"description,omitempty"` + // A Metro ID or code. For interconnections with Dedicated Ports, this will be the location of the issued Dedicated Ports. + Metro string `json:"metro"` + Mode *DedicatedPortCreateInputMode `json:"mode,omitempty"` + Name string `json:"name"` + Project *string `json:"project,omitempty"` + // Either 'primary' or 'redundant'. + Redundancy string `json:"redundancy"` + // A interconnection speed, in bps, mbps, or gbps. For Dedicated Ports, this can be 10Gbps or 100Gbps. + Speed *int64 `json:"speed,omitempty"` + Tags []string `json:"tags,omitempty"` + Type DedicatedPortCreateInputType `json:"type"` + // The intended use case of the dedicated port. + UseCase *string `json:"use_case,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DedicatedPortCreateInput DedicatedPortCreateInput + +// NewDedicatedPortCreateInput instantiates a new DedicatedPortCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDedicatedPortCreateInput(metro string, name string, redundancy string, type_ DedicatedPortCreateInputType) *DedicatedPortCreateInput { + this := DedicatedPortCreateInput{} + this.Metro = metro + this.Name = name + this.Redundancy = redundancy + this.Type = type_ + return &this +} + +// NewDedicatedPortCreateInputWithDefaults instantiates a new DedicatedPortCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDedicatedPortCreateInputWithDefaults() *DedicatedPortCreateInput { + this := DedicatedPortCreateInput{} + return &this +} + +// GetBillingAccountName returns the BillingAccountName field value if set, zero value otherwise. +func (o *DedicatedPortCreateInput) GetBillingAccountName() string { + if o == nil || IsNil(o.BillingAccountName) { + var ret string + return ret + } + return *o.BillingAccountName +} + +// GetBillingAccountNameOk returns a tuple with the BillingAccountName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetBillingAccountNameOk() (*string, bool) { + if o == nil || IsNil(o.BillingAccountName) { + return nil, false + } + return o.BillingAccountName, true +} + +// HasBillingAccountName returns a boolean if a field has been set. +func (o *DedicatedPortCreateInput) HasBillingAccountName() bool { + if o != nil && !IsNil(o.BillingAccountName) { + return true + } + + return false +} + +// SetBillingAccountName gets a reference to the given string and assigns it to the BillingAccountName field. +func (o *DedicatedPortCreateInput) SetBillingAccountName(v string) { + o.BillingAccountName = &v +} + +// GetContactEmail returns the ContactEmail field value if set, zero value otherwise. +func (o *DedicatedPortCreateInput) GetContactEmail() string { + if o == nil || IsNil(o.ContactEmail) { + var ret string + return ret + } + return *o.ContactEmail +} + +// GetContactEmailOk returns a tuple with the ContactEmail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetContactEmailOk() (*string, bool) { + if o == nil || IsNil(o.ContactEmail) { + return nil, false + } + return o.ContactEmail, true +} + +// HasContactEmail returns a boolean if a field has been set. +func (o *DedicatedPortCreateInput) HasContactEmail() bool { + if o != nil && !IsNil(o.ContactEmail) { + return true + } + + return false +} + +// SetContactEmail gets a reference to the given string and assigns it to the ContactEmail field. +func (o *DedicatedPortCreateInput) SetContactEmail(v string) { + o.ContactEmail = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DedicatedPortCreateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *DedicatedPortCreateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *DedicatedPortCreateInput) SetDescription(v string) { + o.Description = &v +} + +// GetMetro returns the Metro field value +func (o *DedicatedPortCreateInput) GetMetro() string { + if o == nil { + var ret string + return ret + } + + return o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetMetroOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metro, true +} + +// SetMetro sets field value +func (o *DedicatedPortCreateInput) SetMetro(v string) { + o.Metro = v +} + +// GetMode returns the Mode field value if set, zero value otherwise. +func (o *DedicatedPortCreateInput) GetMode() DedicatedPortCreateInputMode { + if o == nil || IsNil(o.Mode) { + var ret DedicatedPortCreateInputMode + return ret + } + return *o.Mode +} + +// GetModeOk returns a tuple with the Mode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetModeOk() (*DedicatedPortCreateInputMode, bool) { + if o == nil || IsNil(o.Mode) { + return nil, false + } + return o.Mode, true +} + +// HasMode returns a boolean if a field has been set. +func (o *DedicatedPortCreateInput) HasMode() bool { + if o != nil && !IsNil(o.Mode) { + return true + } + + return false +} + +// SetMode gets a reference to the given DedicatedPortCreateInputMode and assigns it to the Mode field. +func (o *DedicatedPortCreateInput) SetMode(v DedicatedPortCreateInputMode) { + o.Mode = &v +} + +// GetName returns the Name field value +func (o *DedicatedPortCreateInput) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *DedicatedPortCreateInput) SetName(v string) { + o.Name = v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *DedicatedPortCreateInput) GetProject() string { + if o == nil || IsNil(o.Project) { + var ret string + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetProjectOk() (*string, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *DedicatedPortCreateInput) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given string and assigns it to the Project field. +func (o *DedicatedPortCreateInput) SetProject(v string) { + o.Project = &v +} + +// GetRedundancy returns the Redundancy field value +func (o *DedicatedPortCreateInput) GetRedundancy() string { + if o == nil { + var ret string + return ret + } + + return o.Redundancy +} + +// GetRedundancyOk returns a tuple with the Redundancy field value +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetRedundancyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Redundancy, true +} + +// SetRedundancy sets field value +func (o *DedicatedPortCreateInput) SetRedundancy(v string) { + o.Redundancy = v +} + +// GetSpeed returns the Speed field value if set, zero value otherwise. +func (o *DedicatedPortCreateInput) GetSpeed() int64 { + if o == nil || IsNil(o.Speed) { + var ret int64 + return ret + } + return *o.Speed +} + +// GetSpeedOk returns a tuple with the Speed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetSpeedOk() (*int64, bool) { + if o == nil || IsNil(o.Speed) { + return nil, false + } + return o.Speed, true +} + +// HasSpeed returns a boolean if a field has been set. +func (o *DedicatedPortCreateInput) HasSpeed() bool { + if o != nil && !IsNil(o.Speed) { + return true + } + + return false +} + +// SetSpeed gets a reference to the given int64 and assigns it to the Speed field. +func (o *DedicatedPortCreateInput) SetSpeed(v int64) { + o.Speed = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *DedicatedPortCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *DedicatedPortCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *DedicatedPortCreateInput) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value +func (o *DedicatedPortCreateInput) GetType() DedicatedPortCreateInputType { + if o == nil { + var ret DedicatedPortCreateInputType + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetTypeOk() (*DedicatedPortCreateInputType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *DedicatedPortCreateInput) SetType(v DedicatedPortCreateInputType) { + o.Type = v +} + +// GetUseCase returns the UseCase field value if set, zero value otherwise. +func (o *DedicatedPortCreateInput) GetUseCase() string { + if o == nil || IsNil(o.UseCase) { + var ret string + return ret + } + return *o.UseCase +} + +// GetUseCaseOk returns a tuple with the UseCase field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DedicatedPortCreateInput) GetUseCaseOk() (*string, bool) { + if o == nil || IsNil(o.UseCase) { + return nil, false + } + return o.UseCase, true +} + +// HasUseCase returns a boolean if a field has been set. +func (o *DedicatedPortCreateInput) HasUseCase() bool { + if o != nil && !IsNil(o.UseCase) { + return true + } + + return false +} + +// SetUseCase gets a reference to the given string and assigns it to the UseCase field. +func (o *DedicatedPortCreateInput) SetUseCase(v string) { + o.UseCase = &v +} + +func (o DedicatedPortCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DedicatedPortCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BillingAccountName) { + toSerialize["billing_account_name"] = o.BillingAccountName + } + if !IsNil(o.ContactEmail) { + toSerialize["contact_email"] = o.ContactEmail + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["metro"] = o.Metro + if !IsNil(o.Mode) { + toSerialize["mode"] = o.Mode + } + toSerialize["name"] = o.Name + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + toSerialize["redundancy"] = o.Redundancy + if !IsNil(o.Speed) { + toSerialize["speed"] = o.Speed + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + toSerialize["type"] = o.Type + if !IsNil(o.UseCase) { + toSerialize["use_case"] = o.UseCase + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DedicatedPortCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "metro", + "name", + "redundancy", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varDedicatedPortCreateInput := _DedicatedPortCreateInput{} + + err = json.Unmarshal(data, &varDedicatedPortCreateInput) + + if err != nil { + return err + } + + *o = DedicatedPortCreateInput(varDedicatedPortCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "billing_account_name") + delete(additionalProperties, "contact_email") + delete(additionalProperties, "description") + delete(additionalProperties, "metro") + delete(additionalProperties, "mode") + delete(additionalProperties, "name") + delete(additionalProperties, "project") + delete(additionalProperties, "redundancy") + delete(additionalProperties, "speed") + delete(additionalProperties, "tags") + delete(additionalProperties, "type") + delete(additionalProperties, "use_case") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedPortCreateInput struct { + value *DedicatedPortCreateInput + isSet bool +} + +func (v NullableDedicatedPortCreateInput) Get() *DedicatedPortCreateInput { + return v.value +} + +func (v *NullableDedicatedPortCreateInput) Set(val *DedicatedPortCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedPortCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedPortCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedPortCreateInput(val *DedicatedPortCreateInput) *NullableDedicatedPortCreateInput { + return &NullableDedicatedPortCreateInput{value: val, isSet: true} +} + +func (v NullableDedicatedPortCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedPortCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input_mode.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input_mode.go new file mode 100644 index 00000000..3a867f1b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input_mode.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// DedicatedPortCreateInputMode The mode of the interconnection (only relevant to Dedicated Ports). Fabric VCs won't have this field. Can be either 'standard' or 'tunnel'. The default mode of an interconnection on a Dedicated Port is 'standard'. The mode can only be changed when there are no associated virtual circuits on the interconnection. In tunnel mode, an 802.1q tunnel is added to a port to send/receive double tagged packets from server instances. +type DedicatedPortCreateInputMode string + +// List of DedicatedPortCreateInput_mode +const ( + DEDICATEDPORTCREATEINPUTMODE_STANDARD DedicatedPortCreateInputMode = "standard" + DEDICATEDPORTCREATEINPUTMODE_TUNNEL DedicatedPortCreateInputMode = "tunnel" +) + +// All allowed values of DedicatedPortCreateInputMode enum +var AllowedDedicatedPortCreateInputModeEnumValues = []DedicatedPortCreateInputMode{ + "standard", + "tunnel", +} + +func (v *DedicatedPortCreateInputMode) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := DedicatedPortCreateInputMode(value) + for _, existing := range AllowedDedicatedPortCreateInputModeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid DedicatedPortCreateInputMode", value) +} + +// NewDedicatedPortCreateInputModeFromValue returns a pointer to a valid DedicatedPortCreateInputMode +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDedicatedPortCreateInputModeFromValue(v string) (*DedicatedPortCreateInputMode, error) { + ev := DedicatedPortCreateInputMode(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DedicatedPortCreateInputMode: valid values are %v", v, AllowedDedicatedPortCreateInputModeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DedicatedPortCreateInputMode) IsValid() bool { + for _, existing := range AllowedDedicatedPortCreateInputModeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DedicatedPortCreateInput_mode value +func (v DedicatedPortCreateInputMode) Ptr() *DedicatedPortCreateInputMode { + return &v +} + +type NullableDedicatedPortCreateInputMode struct { + value *DedicatedPortCreateInputMode + isSet bool +} + +func (v NullableDedicatedPortCreateInputMode) Get() *DedicatedPortCreateInputMode { + return v.value +} + +func (v *NullableDedicatedPortCreateInputMode) Set(val *DedicatedPortCreateInputMode) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedPortCreateInputMode) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedPortCreateInputMode) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedPortCreateInputMode(val *DedicatedPortCreateInputMode) *NullableDedicatedPortCreateInputMode { + return &NullableDedicatedPortCreateInputMode{value: val, isSet: true} +} + +func (v NullableDedicatedPortCreateInputMode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedPortCreateInputMode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input_type.go new file mode 100644 index 00000000..9e26770a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_dedicated_port_create_input_type.go @@ -0,0 +1,109 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// DedicatedPortCreateInputType When requesting for a dedicated port, the value of this field should be 'dedicated'. +type DedicatedPortCreateInputType string + +// List of DedicatedPortCreateInput_type +const ( + DEDICATEDPORTCREATEINPUTTYPE_DEDICATED DedicatedPortCreateInputType = "dedicated" +) + +// All allowed values of DedicatedPortCreateInputType enum +var AllowedDedicatedPortCreateInputTypeEnumValues = []DedicatedPortCreateInputType{ + "dedicated", +} + +func (v *DedicatedPortCreateInputType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := DedicatedPortCreateInputType(value) + for _, existing := range AllowedDedicatedPortCreateInputTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid DedicatedPortCreateInputType", value) +} + +// NewDedicatedPortCreateInputTypeFromValue returns a pointer to a valid DedicatedPortCreateInputType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDedicatedPortCreateInputTypeFromValue(v string) (*DedicatedPortCreateInputType, error) { + ev := DedicatedPortCreateInputType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DedicatedPortCreateInputType: valid values are %v", v, AllowedDedicatedPortCreateInputTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DedicatedPortCreateInputType) IsValid() bool { + for _, existing := range AllowedDedicatedPortCreateInputTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DedicatedPortCreateInput_type value +func (v DedicatedPortCreateInputType) Ptr() *DedicatedPortCreateInputType { + return &v +} + +type NullableDedicatedPortCreateInputType struct { + value *DedicatedPortCreateInputType + isSet bool +} + +func (v NullableDedicatedPortCreateInputType) Get() *DedicatedPortCreateInputType { + return v.value +} + +func (v *NullableDedicatedPortCreateInputType) Set(val *DedicatedPortCreateInputType) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedPortCreateInputType) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedPortCreateInputType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedPortCreateInputType(val *DedicatedPortCreateInputType) *NullableDedicatedPortCreateInputType { + return &NullableDedicatedPortCreateInputType{value: val, isSet: true} +} + +func (v NullableDedicatedPortCreateInputType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedPortCreateInputType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device.go new file mode 100644 index 00000000..3f6b5004 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device.go @@ -0,0 +1,1721 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the Device type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Device{} + +// Device struct for Device +type Device struct { + AlwaysPxe *bool `json:"always_pxe,omitempty"` + BillingCycle *string `json:"billing_cycle,omitempty"` + BondingMode *int32 `json:"bonding_mode,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + CreatedBy *DeviceCreatedBy `json:"created_by,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Description *string `json:"description,omitempty"` + Facility *Facility `json:"facility,omitempty"` + // The UUID of the firmware set to associate with the device. + FirmwareSetId *string `json:"firmware_set_id,omitempty"` + HardwareReservation *HardwareReservation `json:"hardware_reservation,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + ImageUrl *string `json:"image_url,omitempty"` + IpAddresses []IPAssignment `json:"ip_addresses,omitempty"` + IpxeScriptUrl *string `json:"ipxe_script_url,omitempty"` + Iqn *string `json:"iqn,omitempty"` + // Prevents accidental deletion of this resource when set to true. + Locked *bool `json:"locked,omitempty"` + Metro *DeviceMetro `json:"metro,omitempty"` + // Whether network mode changes such as converting to/from Layer2 or Layer3 networking, bonding or disbonding network interfaces are permitted for the device. + NetworkFrozen *bool `json:"network_frozen,omitempty"` + // By default, servers at Equinix Metal are configured in a “bonded” mode using LACP (Link Aggregation Control Protocol). Each 2-NIC server is configured with a single bond (namely bond0) with both interfaces eth0 and eth1 as members of the bond in a default Layer 3 mode. Some device plans may have a different number of ports and bonds available. + NetworkPorts []Port `json:"network_ports,omitempty"` + OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` + // Actions supported by the device instance. + Actions []DeviceActionsInner `json:"actions,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Project *Project `json:"project,omitempty"` + ProjectLite *DeviceProjectLite `json:"project_lite,omitempty"` + ProvisioningEvents []Event `json:"provisioning_events,omitempty"` + // Only visible while device provisioning + ProvisioningPercentage *float32 `json:"provisioning_percentage,omitempty"` + // Root password is automatically generated when server is provisioned and it is removed after 24 hours + RootPassword *string `json:"root_password,omitempty"` + ShortId *string `json:"short_id,omitempty"` + // Whether or not the device is a spot instance. + SpotInstance *bool `json:"spot_instance,omitempty"` + // The maximum price per hour you are willing to pay to keep this spot instance. If you are outbid, the termination will be set allowing two minutes before shutdown. + SpotPriceMax *float32 `json:"spot_price_max,omitempty"` + SshKeys []Href `json:"ssh_keys,omitempty"` + State *DeviceState `json:"state,omitempty"` + Storage *Storage `json:"storage,omitempty"` + // Switch short id. This can be used to determine if two devices are connected to the same switch, for example. + SwitchUuid *string `json:"switch_uuid,omitempty"` + Tags []string `json:"tags,omitempty"` + // When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. + TerminationTime *time.Time `json:"termination_time,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + User *string `json:"user,omitempty"` + Userdata *string `json:"userdata,omitempty"` + Volumes []Href `json:"volumes,omitempty"` + // Hostname used to connect to the instance via the SOS (Serial over SSH) out-of-band console. + Sos *string `json:"sos,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Device Device + +// NewDevice instantiates a new Device object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDevice() *Device { + this := Device{} + return &this +} + +// NewDeviceWithDefaults instantiates a new Device object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceWithDefaults() *Device { + this := Device{} + return &this +} + +// GetAlwaysPxe returns the AlwaysPxe field value if set, zero value otherwise. +func (o *Device) GetAlwaysPxe() bool { + if o == nil || IsNil(o.AlwaysPxe) { + var ret bool + return ret + } + return *o.AlwaysPxe +} + +// GetAlwaysPxeOk returns a tuple with the AlwaysPxe field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetAlwaysPxeOk() (*bool, bool) { + if o == nil || IsNil(o.AlwaysPxe) { + return nil, false + } + return o.AlwaysPxe, true +} + +// HasAlwaysPxe returns a boolean if a field has been set. +func (o *Device) HasAlwaysPxe() bool { + if o != nil && !IsNil(o.AlwaysPxe) { + return true + } + + return false +} + +// SetAlwaysPxe gets a reference to the given bool and assigns it to the AlwaysPxe field. +func (o *Device) SetAlwaysPxe(v bool) { + o.AlwaysPxe = &v +} + +// GetBillingCycle returns the BillingCycle field value if set, zero value otherwise. +func (o *Device) GetBillingCycle() string { + if o == nil || IsNil(o.BillingCycle) { + var ret string + return ret + } + return *o.BillingCycle +} + +// GetBillingCycleOk returns a tuple with the BillingCycle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetBillingCycleOk() (*string, bool) { + if o == nil || IsNil(o.BillingCycle) { + return nil, false + } + return o.BillingCycle, true +} + +// HasBillingCycle returns a boolean if a field has been set. +func (o *Device) HasBillingCycle() bool { + if o != nil && !IsNil(o.BillingCycle) { + return true + } + + return false +} + +// SetBillingCycle gets a reference to the given string and assigns it to the BillingCycle field. +func (o *Device) SetBillingCycle(v string) { + o.BillingCycle = &v +} + +// GetBondingMode returns the BondingMode field value if set, zero value otherwise. +func (o *Device) GetBondingMode() int32 { + if o == nil || IsNil(o.BondingMode) { + var ret int32 + return ret + } + return *o.BondingMode +} + +// GetBondingModeOk returns a tuple with the BondingMode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetBondingModeOk() (*int32, bool) { + if o == nil || IsNil(o.BondingMode) { + return nil, false + } + return o.BondingMode, true +} + +// HasBondingMode returns a boolean if a field has been set. +func (o *Device) HasBondingMode() bool { + if o != nil && !IsNil(o.BondingMode) { + return true + } + + return false +} + +// SetBondingMode gets a reference to the given int32 and assigns it to the BondingMode field. +func (o *Device) SetBondingMode(v int32) { + o.BondingMode = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Device) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Device) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Device) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *Device) GetCreatedBy() DeviceCreatedBy { + if o == nil || IsNil(o.CreatedBy) { + var ret DeviceCreatedBy + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetCreatedByOk() (*DeviceCreatedBy, bool) { + if o == nil || IsNil(o.CreatedBy) { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *Device) HasCreatedBy() bool { + if o != nil && !IsNil(o.CreatedBy) { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given DeviceCreatedBy and assigns it to the CreatedBy field. +func (o *Device) SetCreatedBy(v DeviceCreatedBy) { + o.CreatedBy = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *Device) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *Device) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *Device) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Device) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Device) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Device) SetDescription(v string) { + o.Description = &v +} + +// GetFacility returns the Facility field value if set, zero value otherwise. +func (o *Device) GetFacility() Facility { + if o == nil || IsNil(o.Facility) { + var ret Facility + return ret + } + return *o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetFacilityOk() (*Facility, bool) { + if o == nil || IsNil(o.Facility) { + return nil, false + } + return o.Facility, true +} + +// HasFacility returns a boolean if a field has been set. +func (o *Device) HasFacility() bool { + if o != nil && !IsNil(o.Facility) { + return true + } + + return false +} + +// SetFacility gets a reference to the given Facility and assigns it to the Facility field. +func (o *Device) SetFacility(v Facility) { + o.Facility = &v +} + +// GetFirmwareSetId returns the FirmwareSetId field value if set, zero value otherwise. +func (o *Device) GetFirmwareSetId() string { + if o == nil || IsNil(o.FirmwareSetId) { + var ret string + return ret + } + return *o.FirmwareSetId +} + +// GetFirmwareSetIdOk returns a tuple with the FirmwareSetId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetFirmwareSetIdOk() (*string, bool) { + if o == nil || IsNil(o.FirmwareSetId) { + return nil, false + } + return o.FirmwareSetId, true +} + +// HasFirmwareSetId returns a boolean if a field has been set. +func (o *Device) HasFirmwareSetId() bool { + if o != nil && !IsNil(o.FirmwareSetId) { + return true + } + + return false +} + +// SetFirmwareSetId gets a reference to the given string and assigns it to the FirmwareSetId field. +func (o *Device) SetFirmwareSetId(v string) { + o.FirmwareSetId = &v +} + +// GetHardwareReservation returns the HardwareReservation field value if set, zero value otherwise. +func (o *Device) GetHardwareReservation() HardwareReservation { + if o == nil || IsNil(o.HardwareReservation) { + var ret HardwareReservation + return ret + } + return *o.HardwareReservation +} + +// GetHardwareReservationOk returns a tuple with the HardwareReservation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetHardwareReservationOk() (*HardwareReservation, bool) { + if o == nil || IsNil(o.HardwareReservation) { + return nil, false + } + return o.HardwareReservation, true +} + +// HasHardwareReservation returns a boolean if a field has been set. +func (o *Device) HasHardwareReservation() bool { + if o != nil && !IsNil(o.HardwareReservation) { + return true + } + + return false +} + +// SetHardwareReservation gets a reference to the given HardwareReservation and assigns it to the HardwareReservation field. +func (o *Device) SetHardwareReservation(v HardwareReservation) { + o.HardwareReservation = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *Device) GetHostname() string { + if o == nil || IsNil(o.Hostname) { + var ret string + return ret + } + return *o.Hostname +} + +// GetHostnameOk returns a tuple with the Hostname field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetHostnameOk() (*string, bool) { + if o == nil || IsNil(o.Hostname) { + return nil, false + } + return o.Hostname, true +} + +// HasHostname returns a boolean if a field has been set. +func (o *Device) HasHostname() bool { + if o != nil && !IsNil(o.Hostname) { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *Device) SetHostname(v string) { + o.Hostname = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Device) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *Device) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Device) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Device) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Device) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Device) SetId(v string) { + o.Id = &v +} + +// GetImageUrl returns the ImageUrl field value if set, zero value otherwise. +func (o *Device) GetImageUrl() string { + if o == nil || IsNil(o.ImageUrl) { + var ret string + return ret + } + return *o.ImageUrl +} + +// GetImageUrlOk returns a tuple with the ImageUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetImageUrlOk() (*string, bool) { + if o == nil || IsNil(o.ImageUrl) { + return nil, false + } + return o.ImageUrl, true +} + +// HasImageUrl returns a boolean if a field has been set. +func (o *Device) HasImageUrl() bool { + if o != nil && !IsNil(o.ImageUrl) { + return true + } + + return false +} + +// SetImageUrl gets a reference to the given string and assigns it to the ImageUrl field. +func (o *Device) SetImageUrl(v string) { + o.ImageUrl = &v +} + +// GetIpAddresses returns the IpAddresses field value if set, zero value otherwise. +func (o *Device) GetIpAddresses() []IPAssignment { + if o == nil || IsNil(o.IpAddresses) { + var ret []IPAssignment + return ret + } + return o.IpAddresses +} + +// GetIpAddressesOk returns a tuple with the IpAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetIpAddressesOk() ([]IPAssignment, bool) { + if o == nil || IsNil(o.IpAddresses) { + return nil, false + } + return o.IpAddresses, true +} + +// HasIpAddresses returns a boolean if a field has been set. +func (o *Device) HasIpAddresses() bool { + if o != nil && !IsNil(o.IpAddresses) { + return true + } + + return false +} + +// SetIpAddresses gets a reference to the given []IPAssignment and assigns it to the IpAddresses field. +func (o *Device) SetIpAddresses(v []IPAssignment) { + o.IpAddresses = v +} + +// GetIpxeScriptUrl returns the IpxeScriptUrl field value if set, zero value otherwise. +func (o *Device) GetIpxeScriptUrl() string { + if o == nil || IsNil(o.IpxeScriptUrl) { + var ret string + return ret + } + return *o.IpxeScriptUrl +} + +// GetIpxeScriptUrlOk returns a tuple with the IpxeScriptUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetIpxeScriptUrlOk() (*string, bool) { + if o == nil || IsNil(o.IpxeScriptUrl) { + return nil, false + } + return o.IpxeScriptUrl, true +} + +// HasIpxeScriptUrl returns a boolean if a field has been set. +func (o *Device) HasIpxeScriptUrl() bool { + if o != nil && !IsNil(o.IpxeScriptUrl) { + return true + } + + return false +} + +// SetIpxeScriptUrl gets a reference to the given string and assigns it to the IpxeScriptUrl field. +func (o *Device) SetIpxeScriptUrl(v string) { + o.IpxeScriptUrl = &v +} + +// GetIqn returns the Iqn field value if set, zero value otherwise. +func (o *Device) GetIqn() string { + if o == nil || IsNil(o.Iqn) { + var ret string + return ret + } + return *o.Iqn +} + +// GetIqnOk returns a tuple with the Iqn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetIqnOk() (*string, bool) { + if o == nil || IsNil(o.Iqn) { + return nil, false + } + return o.Iqn, true +} + +// HasIqn returns a boolean if a field has been set. +func (o *Device) HasIqn() bool { + if o != nil && !IsNil(o.Iqn) { + return true + } + + return false +} + +// SetIqn gets a reference to the given string and assigns it to the Iqn field. +func (o *Device) SetIqn(v string) { + o.Iqn = &v +} + +// GetLocked returns the Locked field value if set, zero value otherwise. +func (o *Device) GetLocked() bool { + if o == nil || IsNil(o.Locked) { + var ret bool + return ret + } + return *o.Locked +} + +// GetLockedOk returns a tuple with the Locked field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetLockedOk() (*bool, bool) { + if o == nil || IsNil(o.Locked) { + return nil, false + } + return o.Locked, true +} + +// HasLocked returns a boolean if a field has been set. +func (o *Device) HasLocked() bool { + if o != nil && !IsNil(o.Locked) { + return true + } + + return false +} + +// SetLocked gets a reference to the given bool and assigns it to the Locked field. +func (o *Device) SetLocked(v bool) { + o.Locked = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *Device) GetMetro() DeviceMetro { + if o == nil || IsNil(o.Metro) { + var ret DeviceMetro + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetMetroOk() (*DeviceMetro, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *Device) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given DeviceMetro and assigns it to the Metro field. +func (o *Device) SetMetro(v DeviceMetro) { + o.Metro = &v +} + +// GetNetworkFrozen returns the NetworkFrozen field value if set, zero value otherwise. +func (o *Device) GetNetworkFrozen() bool { + if o == nil || IsNil(o.NetworkFrozen) { + var ret bool + return ret + } + return *o.NetworkFrozen +} + +// GetNetworkFrozenOk returns a tuple with the NetworkFrozen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetNetworkFrozenOk() (*bool, bool) { + if o == nil || IsNil(o.NetworkFrozen) { + return nil, false + } + return o.NetworkFrozen, true +} + +// HasNetworkFrozen returns a boolean if a field has been set. +func (o *Device) HasNetworkFrozen() bool { + if o != nil && !IsNil(o.NetworkFrozen) { + return true + } + + return false +} + +// SetNetworkFrozen gets a reference to the given bool and assigns it to the NetworkFrozen field. +func (o *Device) SetNetworkFrozen(v bool) { + o.NetworkFrozen = &v +} + +// GetNetworkPorts returns the NetworkPorts field value if set, zero value otherwise. +func (o *Device) GetNetworkPorts() []Port { + if o == nil || IsNil(o.NetworkPorts) { + var ret []Port + return ret + } + return o.NetworkPorts +} + +// GetNetworkPortsOk returns a tuple with the NetworkPorts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetNetworkPortsOk() ([]Port, bool) { + if o == nil || IsNil(o.NetworkPorts) { + return nil, false + } + return o.NetworkPorts, true +} + +// HasNetworkPorts returns a boolean if a field has been set. +func (o *Device) HasNetworkPorts() bool { + if o != nil && !IsNil(o.NetworkPorts) { + return true + } + + return false +} + +// SetNetworkPorts gets a reference to the given []Port and assigns it to the NetworkPorts field. +func (o *Device) SetNetworkPorts(v []Port) { + o.NetworkPorts = v +} + +// GetOperatingSystem returns the OperatingSystem field value if set, zero value otherwise. +func (o *Device) GetOperatingSystem() OperatingSystem { + if o == nil || IsNil(o.OperatingSystem) { + var ret OperatingSystem + return ret + } + return *o.OperatingSystem +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetOperatingSystemOk() (*OperatingSystem, bool) { + if o == nil || IsNil(o.OperatingSystem) { + return nil, false + } + return o.OperatingSystem, true +} + +// HasOperatingSystem returns a boolean if a field has been set. +func (o *Device) HasOperatingSystem() bool { + if o != nil && !IsNil(o.OperatingSystem) { + return true + } + + return false +} + +// SetOperatingSystem gets a reference to the given OperatingSystem and assigns it to the OperatingSystem field. +func (o *Device) SetOperatingSystem(v OperatingSystem) { + o.OperatingSystem = &v +} + +// GetActions returns the Actions field value if set, zero value otherwise. +func (o *Device) GetActions() []DeviceActionsInner { + if o == nil || IsNil(o.Actions) { + var ret []DeviceActionsInner + return ret + } + return o.Actions +} + +// GetActionsOk returns a tuple with the Actions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetActionsOk() ([]DeviceActionsInner, bool) { + if o == nil || IsNil(o.Actions) { + return nil, false + } + return o.Actions, true +} + +// HasActions returns a boolean if a field has been set. +func (o *Device) HasActions() bool { + if o != nil && !IsNil(o.Actions) { + return true + } + + return false +} + +// SetActions gets a reference to the given []DeviceActionsInner and assigns it to the Actions field. +func (o *Device) SetActions(v []DeviceActionsInner) { + o.Actions = v +} + +// GetPlan returns the Plan field value if set, zero value otherwise. +func (o *Device) GetPlan() Plan { + if o == nil || IsNil(o.Plan) { + var ret Plan + return ret + } + return *o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetPlanOk() (*Plan, bool) { + if o == nil || IsNil(o.Plan) { + return nil, false + } + return o.Plan, true +} + +// HasPlan returns a boolean if a field has been set. +func (o *Device) HasPlan() bool { + if o != nil && !IsNil(o.Plan) { + return true + } + + return false +} + +// SetPlan gets a reference to the given Plan and assigns it to the Plan field. +func (o *Device) SetPlan(v Plan) { + o.Plan = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *Device) GetProject() Project { + if o == nil || IsNil(o.Project) { + var ret Project + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetProjectOk() (*Project, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *Device) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Project and assigns it to the Project field. +func (o *Device) SetProject(v Project) { + o.Project = &v +} + +// GetProjectLite returns the ProjectLite field value if set, zero value otherwise. +func (o *Device) GetProjectLite() DeviceProjectLite { + if o == nil || IsNil(o.ProjectLite) { + var ret DeviceProjectLite + return ret + } + return *o.ProjectLite +} + +// GetProjectLiteOk returns a tuple with the ProjectLite field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetProjectLiteOk() (*DeviceProjectLite, bool) { + if o == nil || IsNil(o.ProjectLite) { + return nil, false + } + return o.ProjectLite, true +} + +// HasProjectLite returns a boolean if a field has been set. +func (o *Device) HasProjectLite() bool { + if o != nil && !IsNil(o.ProjectLite) { + return true + } + + return false +} + +// SetProjectLite gets a reference to the given DeviceProjectLite and assigns it to the ProjectLite field. +func (o *Device) SetProjectLite(v DeviceProjectLite) { + o.ProjectLite = &v +} + +// GetProvisioningEvents returns the ProvisioningEvents field value if set, zero value otherwise. +func (o *Device) GetProvisioningEvents() []Event { + if o == nil || IsNil(o.ProvisioningEvents) { + var ret []Event + return ret + } + return o.ProvisioningEvents +} + +// GetProvisioningEventsOk returns a tuple with the ProvisioningEvents field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetProvisioningEventsOk() ([]Event, bool) { + if o == nil || IsNil(o.ProvisioningEvents) { + return nil, false + } + return o.ProvisioningEvents, true +} + +// HasProvisioningEvents returns a boolean if a field has been set. +func (o *Device) HasProvisioningEvents() bool { + if o != nil && !IsNil(o.ProvisioningEvents) { + return true + } + + return false +} + +// SetProvisioningEvents gets a reference to the given []Event and assigns it to the ProvisioningEvents field. +func (o *Device) SetProvisioningEvents(v []Event) { + o.ProvisioningEvents = v +} + +// GetProvisioningPercentage returns the ProvisioningPercentage field value if set, zero value otherwise. +func (o *Device) GetProvisioningPercentage() float32 { + if o == nil || IsNil(o.ProvisioningPercentage) { + var ret float32 + return ret + } + return *o.ProvisioningPercentage +} + +// GetProvisioningPercentageOk returns a tuple with the ProvisioningPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetProvisioningPercentageOk() (*float32, bool) { + if o == nil || IsNil(o.ProvisioningPercentage) { + return nil, false + } + return o.ProvisioningPercentage, true +} + +// HasProvisioningPercentage returns a boolean if a field has been set. +func (o *Device) HasProvisioningPercentage() bool { + if o != nil && !IsNil(o.ProvisioningPercentage) { + return true + } + + return false +} + +// SetProvisioningPercentage gets a reference to the given float32 and assigns it to the ProvisioningPercentage field. +func (o *Device) SetProvisioningPercentage(v float32) { + o.ProvisioningPercentage = &v +} + +// GetRootPassword returns the RootPassword field value if set, zero value otherwise. +func (o *Device) GetRootPassword() string { + if o == nil || IsNil(o.RootPassword) { + var ret string + return ret + } + return *o.RootPassword +} + +// GetRootPasswordOk returns a tuple with the RootPassword field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetRootPasswordOk() (*string, bool) { + if o == nil || IsNil(o.RootPassword) { + return nil, false + } + return o.RootPassword, true +} + +// HasRootPassword returns a boolean if a field has been set. +func (o *Device) HasRootPassword() bool { + if o != nil && !IsNil(o.RootPassword) { + return true + } + + return false +} + +// SetRootPassword gets a reference to the given string and assigns it to the RootPassword field. +func (o *Device) SetRootPassword(v string) { + o.RootPassword = &v +} + +// GetShortId returns the ShortId field value if set, zero value otherwise. +func (o *Device) GetShortId() string { + if o == nil || IsNil(o.ShortId) { + var ret string + return ret + } + return *o.ShortId +} + +// GetShortIdOk returns a tuple with the ShortId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetShortIdOk() (*string, bool) { + if o == nil || IsNil(o.ShortId) { + return nil, false + } + return o.ShortId, true +} + +// HasShortId returns a boolean if a field has been set. +func (o *Device) HasShortId() bool { + if o != nil && !IsNil(o.ShortId) { + return true + } + + return false +} + +// SetShortId gets a reference to the given string and assigns it to the ShortId field. +func (o *Device) SetShortId(v string) { + o.ShortId = &v +} + +// GetSpotInstance returns the SpotInstance field value if set, zero value otherwise. +func (o *Device) GetSpotInstance() bool { + if o == nil || IsNil(o.SpotInstance) { + var ret bool + return ret + } + return *o.SpotInstance +} + +// GetSpotInstanceOk returns a tuple with the SpotInstance field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetSpotInstanceOk() (*bool, bool) { + if o == nil || IsNil(o.SpotInstance) { + return nil, false + } + return o.SpotInstance, true +} + +// HasSpotInstance returns a boolean if a field has been set. +func (o *Device) HasSpotInstance() bool { + if o != nil && !IsNil(o.SpotInstance) { + return true + } + + return false +} + +// SetSpotInstance gets a reference to the given bool and assigns it to the SpotInstance field. +func (o *Device) SetSpotInstance(v bool) { + o.SpotInstance = &v +} + +// GetSpotPriceMax returns the SpotPriceMax field value if set, zero value otherwise. +func (o *Device) GetSpotPriceMax() float32 { + if o == nil || IsNil(o.SpotPriceMax) { + var ret float32 + return ret + } + return *o.SpotPriceMax +} + +// GetSpotPriceMaxOk returns a tuple with the SpotPriceMax field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetSpotPriceMaxOk() (*float32, bool) { + if o == nil || IsNil(o.SpotPriceMax) { + return nil, false + } + return o.SpotPriceMax, true +} + +// HasSpotPriceMax returns a boolean if a field has been set. +func (o *Device) HasSpotPriceMax() bool { + if o != nil && !IsNil(o.SpotPriceMax) { + return true + } + + return false +} + +// SetSpotPriceMax gets a reference to the given float32 and assigns it to the SpotPriceMax field. +func (o *Device) SetSpotPriceMax(v float32) { + o.SpotPriceMax = &v +} + +// GetSshKeys returns the SshKeys field value if set, zero value otherwise. +func (o *Device) GetSshKeys() []Href { + if o == nil || IsNil(o.SshKeys) { + var ret []Href + return ret + } + return o.SshKeys +} + +// GetSshKeysOk returns a tuple with the SshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetSshKeysOk() ([]Href, bool) { + if o == nil || IsNil(o.SshKeys) { + return nil, false + } + return o.SshKeys, true +} + +// HasSshKeys returns a boolean if a field has been set. +func (o *Device) HasSshKeys() bool { + if o != nil && !IsNil(o.SshKeys) { + return true + } + + return false +} + +// SetSshKeys gets a reference to the given []Href and assigns it to the SshKeys field. +func (o *Device) SetSshKeys(v []Href) { + o.SshKeys = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Device) GetState() DeviceState { + if o == nil || IsNil(o.State) { + var ret DeviceState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetStateOk() (*DeviceState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Device) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given DeviceState and assigns it to the State field. +func (o *Device) SetState(v DeviceState) { + o.State = &v +} + +// GetStorage returns the Storage field value if set, zero value otherwise. +func (o *Device) GetStorage() Storage { + if o == nil || IsNil(o.Storage) { + var ret Storage + return ret + } + return *o.Storage +} + +// GetStorageOk returns a tuple with the Storage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetStorageOk() (*Storage, bool) { + if o == nil || IsNil(o.Storage) { + return nil, false + } + return o.Storage, true +} + +// HasStorage returns a boolean if a field has been set. +func (o *Device) HasStorage() bool { + if o != nil && !IsNil(o.Storage) { + return true + } + + return false +} + +// SetStorage gets a reference to the given Storage and assigns it to the Storage field. +func (o *Device) SetStorage(v Storage) { + o.Storage = &v +} + +// GetSwitchUuid returns the SwitchUuid field value if set, zero value otherwise. +func (o *Device) GetSwitchUuid() string { + if o == nil || IsNil(o.SwitchUuid) { + var ret string + return ret + } + return *o.SwitchUuid +} + +// GetSwitchUuidOk returns a tuple with the SwitchUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetSwitchUuidOk() (*string, bool) { + if o == nil || IsNil(o.SwitchUuid) { + return nil, false + } + return o.SwitchUuid, true +} + +// HasSwitchUuid returns a boolean if a field has been set. +func (o *Device) HasSwitchUuid() bool { + if o != nil && !IsNil(o.SwitchUuid) { + return true + } + + return false +} + +// SetSwitchUuid gets a reference to the given string and assigns it to the SwitchUuid field. +func (o *Device) SetSwitchUuid(v string) { + o.SwitchUuid = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Device) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *Device) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *Device) SetTags(v []string) { + o.Tags = v +} + +// GetTerminationTime returns the TerminationTime field value if set, zero value otherwise. +func (o *Device) GetTerminationTime() time.Time { + if o == nil || IsNil(o.TerminationTime) { + var ret time.Time + return ret + } + return *o.TerminationTime +} + +// GetTerminationTimeOk returns a tuple with the TerminationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetTerminationTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.TerminationTime) { + return nil, false + } + return o.TerminationTime, true +} + +// HasTerminationTime returns a boolean if a field has been set. +func (o *Device) HasTerminationTime() bool { + if o != nil && !IsNil(o.TerminationTime) { + return true + } + + return false +} + +// SetTerminationTime gets a reference to the given time.Time and assigns it to the TerminationTime field. +func (o *Device) SetTerminationTime(v time.Time) { + o.TerminationTime = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Device) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Device) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Device) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetUser returns the User field value if set, zero value otherwise. +func (o *Device) GetUser() string { + if o == nil || IsNil(o.User) { + var ret string + return ret + } + return *o.User +} + +// GetUserOk returns a tuple with the User field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetUserOk() (*string, bool) { + if o == nil || IsNil(o.User) { + return nil, false + } + return o.User, true +} + +// HasUser returns a boolean if a field has been set. +func (o *Device) HasUser() bool { + if o != nil && !IsNil(o.User) { + return true + } + + return false +} + +// SetUser gets a reference to the given string and assigns it to the User field. +func (o *Device) SetUser(v string) { + o.User = &v +} + +// GetUserdata returns the Userdata field value if set, zero value otherwise. +func (o *Device) GetUserdata() string { + if o == nil || IsNil(o.Userdata) { + var ret string + return ret + } + return *o.Userdata +} + +// GetUserdataOk returns a tuple with the Userdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetUserdataOk() (*string, bool) { + if o == nil || IsNil(o.Userdata) { + return nil, false + } + return o.Userdata, true +} + +// HasUserdata returns a boolean if a field has been set. +func (o *Device) HasUserdata() bool { + if o != nil && !IsNil(o.Userdata) { + return true + } + + return false +} + +// SetUserdata gets a reference to the given string and assigns it to the Userdata field. +func (o *Device) SetUserdata(v string) { + o.Userdata = &v +} + +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *Device) GetVolumes() []Href { + if o == nil || IsNil(o.Volumes) { + var ret []Href + return ret + } + return o.Volumes +} + +// GetVolumesOk returns a tuple with the Volumes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetVolumesOk() ([]Href, bool) { + if o == nil || IsNil(o.Volumes) { + return nil, false + } + return o.Volumes, true +} + +// HasVolumes returns a boolean if a field has been set. +func (o *Device) HasVolumes() bool { + if o != nil && !IsNil(o.Volumes) { + return true + } + + return false +} + +// SetVolumes gets a reference to the given []Href and assigns it to the Volumes field. +func (o *Device) SetVolumes(v []Href) { + o.Volumes = v +} + +// GetSos returns the Sos field value if set, zero value otherwise. +func (o *Device) GetSos() string { + if o == nil || IsNil(o.Sos) { + var ret string + return ret + } + return *o.Sos +} + +// GetSosOk returns a tuple with the Sos field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Device) GetSosOk() (*string, bool) { + if o == nil || IsNil(o.Sos) { + return nil, false + } + return o.Sos, true +} + +// HasSos returns a boolean if a field has been set. +func (o *Device) HasSos() bool { + if o != nil && !IsNil(o.Sos) { + return true + } + + return false +} + +// SetSos gets a reference to the given string and assigns it to the Sos field. +func (o *Device) SetSos(v string) { + o.Sos = &v +} + +func (o Device) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Device) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AlwaysPxe) { + toSerialize["always_pxe"] = o.AlwaysPxe + } + if !IsNil(o.BillingCycle) { + toSerialize["billing_cycle"] = o.BillingCycle + } + if !IsNil(o.BondingMode) { + toSerialize["bonding_mode"] = o.BondingMode + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.CreatedBy) { + toSerialize["created_by"] = o.CreatedBy + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Facility) { + toSerialize["facility"] = o.Facility + } + if !IsNil(o.FirmwareSetId) { + toSerialize["firmware_set_id"] = o.FirmwareSetId + } + if !IsNil(o.HardwareReservation) { + toSerialize["hardware_reservation"] = o.HardwareReservation + } + if !IsNil(o.Hostname) { + toSerialize["hostname"] = o.Hostname + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.ImageUrl) { + toSerialize["image_url"] = o.ImageUrl + } + if !IsNil(o.IpAddresses) { + toSerialize["ip_addresses"] = o.IpAddresses + } + if !IsNil(o.IpxeScriptUrl) { + toSerialize["ipxe_script_url"] = o.IpxeScriptUrl + } + if !IsNil(o.Iqn) { + toSerialize["iqn"] = o.Iqn + } + if !IsNil(o.Locked) { + toSerialize["locked"] = o.Locked + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.NetworkFrozen) { + toSerialize["network_frozen"] = o.NetworkFrozen + } + if !IsNil(o.NetworkPorts) { + toSerialize["network_ports"] = o.NetworkPorts + } + if !IsNil(o.OperatingSystem) { + toSerialize["operating_system"] = o.OperatingSystem + } + if !IsNil(o.Actions) { + toSerialize["actions"] = o.Actions + } + if !IsNil(o.Plan) { + toSerialize["plan"] = o.Plan + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.ProjectLite) { + toSerialize["project_lite"] = o.ProjectLite + } + if !IsNil(o.ProvisioningEvents) { + toSerialize["provisioning_events"] = o.ProvisioningEvents + } + if !IsNil(o.ProvisioningPercentage) { + toSerialize["provisioning_percentage"] = o.ProvisioningPercentage + } + if !IsNil(o.RootPassword) { + toSerialize["root_password"] = o.RootPassword + } + if !IsNil(o.ShortId) { + toSerialize["short_id"] = o.ShortId + } + if !IsNil(o.SpotInstance) { + toSerialize["spot_instance"] = o.SpotInstance + } + if !IsNil(o.SpotPriceMax) { + toSerialize["spot_price_max"] = o.SpotPriceMax + } + if !IsNil(o.SshKeys) { + toSerialize["ssh_keys"] = o.SshKeys + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Storage) { + toSerialize["storage"] = o.Storage + } + if !IsNil(o.SwitchUuid) { + toSerialize["switch_uuid"] = o.SwitchUuid + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.TerminationTime) { + toSerialize["termination_time"] = o.TerminationTime + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.User) { + toSerialize["user"] = o.User + } + if !IsNil(o.Userdata) { + toSerialize["userdata"] = o.Userdata + } + if !IsNil(o.Volumes) { + toSerialize["volumes"] = o.Volumes + } + if !IsNil(o.Sos) { + toSerialize["sos"] = o.Sos + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Device) UnmarshalJSON(data []byte) (err error) { + varDevice := _Device{} + + err = json.Unmarshal(data, &varDevice) + + if err != nil { + return err + } + + *o = Device(varDevice) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "always_pxe") + delete(additionalProperties, "billing_cycle") + delete(additionalProperties, "bonding_mode") + delete(additionalProperties, "created_at") + delete(additionalProperties, "created_by") + delete(additionalProperties, "customdata") + delete(additionalProperties, "description") + delete(additionalProperties, "facility") + delete(additionalProperties, "firmware_set_id") + delete(additionalProperties, "hardware_reservation") + delete(additionalProperties, "hostname") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "image_url") + delete(additionalProperties, "ip_addresses") + delete(additionalProperties, "ipxe_script_url") + delete(additionalProperties, "iqn") + delete(additionalProperties, "locked") + delete(additionalProperties, "metro") + delete(additionalProperties, "network_frozen") + delete(additionalProperties, "network_ports") + delete(additionalProperties, "operating_system") + delete(additionalProperties, "actions") + delete(additionalProperties, "plan") + delete(additionalProperties, "project") + delete(additionalProperties, "project_lite") + delete(additionalProperties, "provisioning_events") + delete(additionalProperties, "provisioning_percentage") + delete(additionalProperties, "root_password") + delete(additionalProperties, "short_id") + delete(additionalProperties, "spot_instance") + delete(additionalProperties, "spot_price_max") + delete(additionalProperties, "ssh_keys") + delete(additionalProperties, "state") + delete(additionalProperties, "storage") + delete(additionalProperties, "switch_uuid") + delete(additionalProperties, "tags") + delete(additionalProperties, "termination_time") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "user") + delete(additionalProperties, "userdata") + delete(additionalProperties, "volumes") + delete(additionalProperties, "sos") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDevice struct { + value *Device + isSet bool +} + +func (v NullableDevice) Get() *Device { + return v.value +} + +func (v *NullableDevice) Set(val *Device) { + v.value = val + v.isSet = true +} + +func (v NullableDevice) IsSet() bool { + return v.isSet +} + +func (v *NullableDevice) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDevice(val *Device) *NullableDevice { + return &NullableDevice{value: val, isSet: true} +} + +func (v NullableDevice) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDevice) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_action_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_action_input.go new file mode 100644 index 00000000..e3b81341 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_action_input.go @@ -0,0 +1,357 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the DeviceActionInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceActionInput{} + +// DeviceActionInput struct for DeviceActionInput +type DeviceActionInput struct { + Type DeviceActionInputType `json:"type"` + // May be required to perform actions under certain conditions + ForceDelete *bool `json:"force_delete,omitempty"` + // When type is `reinstall`, enabling fast deprovisioning will bypass full disk wiping. + DeprovisionFast *bool `json:"deprovision_fast,omitempty"` + // When type is `reinstall`, preserve the existing data on all disks except the operating-system disk. + PreserveData *bool `json:"preserve_data,omitempty"` + // When type is `reinstall`, use this `operating_system` (defaults to the current `operating system`) + OperatingSystem *string `json:"operating_system,omitempty"` + // When type is `reinstall`, use this `ipxe_script_url` (`operating_system` must be `custom_ipxe`, defaults to the current `ipxe_script_url`) + IpxeScriptUrl *string `json:"ipxe_script_url,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceActionInput DeviceActionInput + +// NewDeviceActionInput instantiates a new DeviceActionInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceActionInput(type_ DeviceActionInputType) *DeviceActionInput { + this := DeviceActionInput{} + this.Type = type_ + return &this +} + +// NewDeviceActionInputWithDefaults instantiates a new DeviceActionInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceActionInputWithDefaults() *DeviceActionInput { + this := DeviceActionInput{} + return &this +} + +// GetType returns the Type field value +func (o *DeviceActionInput) GetType() DeviceActionInputType { + if o == nil { + var ret DeviceActionInputType + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *DeviceActionInput) GetTypeOk() (*DeviceActionInputType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *DeviceActionInput) SetType(v DeviceActionInputType) { + o.Type = v +} + +// GetForceDelete returns the ForceDelete field value if set, zero value otherwise. +func (o *DeviceActionInput) GetForceDelete() bool { + if o == nil || IsNil(o.ForceDelete) { + var ret bool + return ret + } + return *o.ForceDelete +} + +// GetForceDeleteOk returns a tuple with the ForceDelete field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceActionInput) GetForceDeleteOk() (*bool, bool) { + if o == nil || IsNil(o.ForceDelete) { + return nil, false + } + return o.ForceDelete, true +} + +// HasForceDelete returns a boolean if a field has been set. +func (o *DeviceActionInput) HasForceDelete() bool { + if o != nil && !IsNil(o.ForceDelete) { + return true + } + + return false +} + +// SetForceDelete gets a reference to the given bool and assigns it to the ForceDelete field. +func (o *DeviceActionInput) SetForceDelete(v bool) { + o.ForceDelete = &v +} + +// GetDeprovisionFast returns the DeprovisionFast field value if set, zero value otherwise. +func (o *DeviceActionInput) GetDeprovisionFast() bool { + if o == nil || IsNil(o.DeprovisionFast) { + var ret bool + return ret + } + return *o.DeprovisionFast +} + +// GetDeprovisionFastOk returns a tuple with the DeprovisionFast field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceActionInput) GetDeprovisionFastOk() (*bool, bool) { + if o == nil || IsNil(o.DeprovisionFast) { + return nil, false + } + return o.DeprovisionFast, true +} + +// HasDeprovisionFast returns a boolean if a field has been set. +func (o *DeviceActionInput) HasDeprovisionFast() bool { + if o != nil && !IsNil(o.DeprovisionFast) { + return true + } + + return false +} + +// SetDeprovisionFast gets a reference to the given bool and assigns it to the DeprovisionFast field. +func (o *DeviceActionInput) SetDeprovisionFast(v bool) { + o.DeprovisionFast = &v +} + +// GetPreserveData returns the PreserveData field value if set, zero value otherwise. +func (o *DeviceActionInput) GetPreserveData() bool { + if o == nil || IsNil(o.PreserveData) { + var ret bool + return ret + } + return *o.PreserveData +} + +// GetPreserveDataOk returns a tuple with the PreserveData field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceActionInput) GetPreserveDataOk() (*bool, bool) { + if o == nil || IsNil(o.PreserveData) { + return nil, false + } + return o.PreserveData, true +} + +// HasPreserveData returns a boolean if a field has been set. +func (o *DeviceActionInput) HasPreserveData() bool { + if o != nil && !IsNil(o.PreserveData) { + return true + } + + return false +} + +// SetPreserveData gets a reference to the given bool and assigns it to the PreserveData field. +func (o *DeviceActionInput) SetPreserveData(v bool) { + o.PreserveData = &v +} + +// GetOperatingSystem returns the OperatingSystem field value if set, zero value otherwise. +func (o *DeviceActionInput) GetOperatingSystem() string { + if o == nil || IsNil(o.OperatingSystem) { + var ret string + return ret + } + return *o.OperatingSystem +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceActionInput) GetOperatingSystemOk() (*string, bool) { + if o == nil || IsNil(o.OperatingSystem) { + return nil, false + } + return o.OperatingSystem, true +} + +// HasOperatingSystem returns a boolean if a field has been set. +func (o *DeviceActionInput) HasOperatingSystem() bool { + if o != nil && !IsNil(o.OperatingSystem) { + return true + } + + return false +} + +// SetOperatingSystem gets a reference to the given string and assigns it to the OperatingSystem field. +func (o *DeviceActionInput) SetOperatingSystem(v string) { + o.OperatingSystem = &v +} + +// GetIpxeScriptUrl returns the IpxeScriptUrl field value if set, zero value otherwise. +func (o *DeviceActionInput) GetIpxeScriptUrl() string { + if o == nil || IsNil(o.IpxeScriptUrl) { + var ret string + return ret + } + return *o.IpxeScriptUrl +} + +// GetIpxeScriptUrlOk returns a tuple with the IpxeScriptUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceActionInput) GetIpxeScriptUrlOk() (*string, bool) { + if o == nil || IsNil(o.IpxeScriptUrl) { + return nil, false + } + return o.IpxeScriptUrl, true +} + +// HasIpxeScriptUrl returns a boolean if a field has been set. +func (o *DeviceActionInput) HasIpxeScriptUrl() bool { + if o != nil && !IsNil(o.IpxeScriptUrl) { + return true + } + + return false +} + +// SetIpxeScriptUrl gets a reference to the given string and assigns it to the IpxeScriptUrl field. +func (o *DeviceActionInput) SetIpxeScriptUrl(v string) { + o.IpxeScriptUrl = &v +} + +func (o DeviceActionInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceActionInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["type"] = o.Type + if !IsNil(o.ForceDelete) { + toSerialize["force_delete"] = o.ForceDelete + } + if !IsNil(o.DeprovisionFast) { + toSerialize["deprovision_fast"] = o.DeprovisionFast + } + if !IsNil(o.PreserveData) { + toSerialize["preserve_data"] = o.PreserveData + } + if !IsNil(o.OperatingSystem) { + toSerialize["operating_system"] = o.OperatingSystem + } + if !IsNil(o.IpxeScriptUrl) { + toSerialize["ipxe_script_url"] = o.IpxeScriptUrl + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceActionInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varDeviceActionInput := _DeviceActionInput{} + + err = json.Unmarshal(data, &varDeviceActionInput) + + if err != nil { + return err + } + + *o = DeviceActionInput(varDeviceActionInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "type") + delete(additionalProperties, "force_delete") + delete(additionalProperties, "deprovision_fast") + delete(additionalProperties, "preserve_data") + delete(additionalProperties, "operating_system") + delete(additionalProperties, "ipxe_script_url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceActionInput struct { + value *DeviceActionInput + isSet bool +} + +func (v NullableDeviceActionInput) Get() *DeviceActionInput { + return v.value +} + +func (v *NullableDeviceActionInput) Set(val *DeviceActionInput) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceActionInput) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceActionInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceActionInput(val *DeviceActionInput) *NullableDeviceActionInput { + return &NullableDeviceActionInput{value: val, isSet: true} +} + +func (v NullableDeviceActionInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceActionInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_action_input_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_action_input_type.go new file mode 100644 index 00000000..da3446d4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_action_input_type.go @@ -0,0 +1,117 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// DeviceActionInputType Action to perform. See Device.actions for possible actions. +type DeviceActionInputType string + +// List of DeviceActionInput_type +const ( + DEVICEACTIONINPUTTYPE_POWER_ON DeviceActionInputType = "power_on" + DEVICEACTIONINPUTTYPE_POWER_OFF DeviceActionInputType = "power_off" + DEVICEACTIONINPUTTYPE_REBOOT DeviceActionInputType = "reboot" + DEVICEACTIONINPUTTYPE_RESCUE DeviceActionInputType = "rescue" + DEVICEACTIONINPUTTYPE_REINSTALL DeviceActionInputType = "reinstall" +) + +// All allowed values of DeviceActionInputType enum +var AllowedDeviceActionInputTypeEnumValues = []DeviceActionInputType{ + "power_on", + "power_off", + "reboot", + "rescue", + "reinstall", +} + +func (v *DeviceActionInputType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := DeviceActionInputType(value) + for _, existing := range AllowedDeviceActionInputTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid DeviceActionInputType", value) +} + +// NewDeviceActionInputTypeFromValue returns a pointer to a valid DeviceActionInputType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDeviceActionInputTypeFromValue(v string) (*DeviceActionInputType, error) { + ev := DeviceActionInputType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DeviceActionInputType: valid values are %v", v, AllowedDeviceActionInputTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DeviceActionInputType) IsValid() bool { + for _, existing := range AllowedDeviceActionInputTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DeviceActionInput_type value +func (v DeviceActionInputType) Ptr() *DeviceActionInputType { + return &v +} + +type NullableDeviceActionInputType struct { + value *DeviceActionInputType + isSet bool +} + +func (v NullableDeviceActionInputType) Get() *DeviceActionInputType { + return v.value +} + +func (v *NullableDeviceActionInputType) Set(val *DeviceActionInputType) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceActionInputType) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceActionInputType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceActionInputType(val *DeviceActionInputType) *NullableDeviceActionInputType { + return &NullableDeviceActionInputType{value: val, isSet: true} +} + +func (v NullableDeviceActionInputType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceActionInputType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_actions_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_actions_inner.go new file mode 100644 index 00000000..2ca2afdb --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_actions_inner.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the DeviceActionsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceActionsInner{} + +// DeviceActionsInner struct for DeviceActionsInner +type DeviceActionsInner struct { + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceActionsInner DeviceActionsInner + +// NewDeviceActionsInner instantiates a new DeviceActionsInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceActionsInner() *DeviceActionsInner { + this := DeviceActionsInner{} + return &this +} + +// NewDeviceActionsInnerWithDefaults instantiates a new DeviceActionsInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceActionsInnerWithDefaults() *DeviceActionsInner { + this := DeviceActionsInner{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DeviceActionsInner) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceActionsInner) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DeviceActionsInner) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *DeviceActionsInner) SetType(v string) { + o.Type = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DeviceActionsInner) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceActionsInner) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *DeviceActionsInner) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DeviceActionsInner) SetName(v string) { + o.Name = &v +} + +func (o DeviceActionsInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceActionsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceActionsInner) UnmarshalJSON(data []byte) (err error) { + varDeviceActionsInner := _DeviceActionsInner{} + + err = json.Unmarshal(data, &varDeviceActionsInner) + + if err != nil { + return err + } + + *o = DeviceActionsInner(varDeviceActionsInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "type") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceActionsInner struct { + value *DeviceActionsInner + isSet bool +} + +func (v NullableDeviceActionsInner) Get() *DeviceActionsInner { + return v.value +} + +func (v *NullableDeviceActionsInner) Set(val *DeviceActionsInner) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceActionsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceActionsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceActionsInner(val *DeviceActionsInner) *NullableDeviceActionsInner { + return &NullableDeviceActionsInner{value: val, isSet: true} +} + +func (v NullableDeviceActionsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceActionsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_in_facility_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_in_facility_input.go new file mode 100644 index 00000000..babe7852 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_in_facility_input.go @@ -0,0 +1,1128 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the DeviceCreateInFacilityInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceCreateInFacilityInput{} + +// DeviceCreateInFacilityInput struct for DeviceCreateInFacilityInput +type DeviceCreateInFacilityInput struct { + // The datacenter where the device should be created. Either metro or facility must be provided. The API will accept either a single facility `{ \"facility\": \"f1\" }`, or it can be instructed to create the device in the best available datacenter `{ \"facility\": \"any\" }`. Additionally it is possible to set a prioritized location selection. For example `{ \"facility\": [\"f3\", \"f2\", \"any\"] }` can be used to prioritize `f3` and then `f2` before accepting `any` facility. If none of the facilities provided have availability for the requested device the request will fail. + // Deprecated + Facility []string `json:"facility"` + // When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot. + AlwaysPxe *bool `json:"always_pxe,omitempty"` + BillingCycle *DeviceCreateInputBillingCycle `json:"billing_cycle,omitempty"` + // Customdata is an arbitrary JSON value that can be accessed via the metadata service. + Customdata map[string]interface{} `json:"customdata,omitempty"` + // Any description of the device or how it will be used. This may be used to inform other API consumers with project access. + Description *string `json:"description,omitempty"` + // The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria. + Features []string `json:"features,omitempty"` + // The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details. + HardwareReservationId *string `json:"hardware_reservation_id,omitempty"` + // The hostname to use within the operating system. The same hostname may be used on multiple devices within a project. + Hostname *string `json:"hostname,omitempty"` + // The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled. + IpAddresses []IPAddress `json:"ip_addresses,omitempty"` + // When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details. + IpxeScriptUrl *string `json:"ipxe_script_url,omitempty"` + // Whether the device should be locked, preventing accidental deletion. + Locked *bool `json:"locked,omitempty"` + // If true, this instance can not be converted to a different network type. + NetworkFrozen *bool `json:"network_frozen,omitempty"` + // Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified + NoSshKeys *bool `json:"no_ssh_keys,omitempty"` + // The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans. + OperatingSystem string `json:"operating_system"` + // The slug of the device plan to provision. + Plan string `json:"plan"` + // Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. + PrivateIpv4SubnetSize *int32 `json:"private_ipv4_subnet_size,omitempty"` + // A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. + ProjectSshKeys []string `json:"project_ssh_keys,omitempty"` + // Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request. + PublicIpv4SubnetSize *int32 `json:"public_ipv4_subnet_size,omitempty"` + // Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field. + SpotInstance *bool `json:"spot_instance,omitempty"` + // The maximum amount to bid for a spot instance. + SpotPriceMax *float32 `json:"spot_price_max,omitempty"` + // A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. + SshKeys []SSHKeyInput `json:"ssh_keys,omitempty"` + Storage *Storage `json:"storage,omitempty"` + Tags []string `json:"tags,omitempty"` + // When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. + TerminationTime *time.Time `json:"termination_time,omitempty"` + // A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. + UserSshKeys []string `json:"user_ssh_keys,omitempty"` + // The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details. + Userdata *string `json:"userdata,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceCreateInFacilityInput DeviceCreateInFacilityInput + +// NewDeviceCreateInFacilityInput instantiates a new DeviceCreateInFacilityInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceCreateInFacilityInput(facility []string, operatingSystem string, plan string) *DeviceCreateInFacilityInput { + this := DeviceCreateInFacilityInput{} + this.Facility = facility + var alwaysPxe bool = false + this.AlwaysPxe = &alwaysPxe + var hardwareReservationId string = "" + this.HardwareReservationId = &hardwareReservationId + var locked bool = false + this.Locked = &locked + var noSshKeys bool = false + this.NoSshKeys = &noSshKeys + this.OperatingSystem = operatingSystem + this.Plan = plan + var privateIpv4SubnetSize int32 = 28 + this.PrivateIpv4SubnetSize = &privateIpv4SubnetSize + var publicIpv4SubnetSize int32 = 31 + this.PublicIpv4SubnetSize = &publicIpv4SubnetSize + return &this +} + +// NewDeviceCreateInFacilityInputWithDefaults instantiates a new DeviceCreateInFacilityInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceCreateInFacilityInputWithDefaults() *DeviceCreateInFacilityInput { + this := DeviceCreateInFacilityInput{} + var alwaysPxe bool = false + this.AlwaysPxe = &alwaysPxe + var hardwareReservationId string = "" + this.HardwareReservationId = &hardwareReservationId + var locked bool = false + this.Locked = &locked + var noSshKeys bool = false + this.NoSshKeys = &noSshKeys + var privateIpv4SubnetSize int32 = 28 + this.PrivateIpv4SubnetSize = &privateIpv4SubnetSize + var publicIpv4SubnetSize int32 = 31 + this.PublicIpv4SubnetSize = &publicIpv4SubnetSize + return &this +} + +// GetFacility returns the Facility field value +// Deprecated +func (o *DeviceCreateInFacilityInput) GetFacility() []string { + if o == nil { + var ret []string + return ret + } + + return o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *DeviceCreateInFacilityInput) GetFacilityOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Facility, true +} + +// SetFacility sets field value +// Deprecated +func (o *DeviceCreateInFacilityInput) SetFacility(v []string) { + o.Facility = v +} + +// GetAlwaysPxe returns the AlwaysPxe field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetAlwaysPxe() bool { + if o == nil || IsNil(o.AlwaysPxe) { + var ret bool + return ret + } + return *o.AlwaysPxe +} + +// GetAlwaysPxeOk returns a tuple with the AlwaysPxe field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetAlwaysPxeOk() (*bool, bool) { + if o == nil || IsNil(o.AlwaysPxe) { + return nil, false + } + return o.AlwaysPxe, true +} + +// HasAlwaysPxe returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasAlwaysPxe() bool { + if o != nil && !IsNil(o.AlwaysPxe) { + return true + } + + return false +} + +// SetAlwaysPxe gets a reference to the given bool and assigns it to the AlwaysPxe field. +func (o *DeviceCreateInFacilityInput) SetAlwaysPxe(v bool) { + o.AlwaysPxe = &v +} + +// GetBillingCycle returns the BillingCycle field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetBillingCycle() DeviceCreateInputBillingCycle { + if o == nil || IsNil(o.BillingCycle) { + var ret DeviceCreateInputBillingCycle + return ret + } + return *o.BillingCycle +} + +// GetBillingCycleOk returns a tuple with the BillingCycle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetBillingCycleOk() (*DeviceCreateInputBillingCycle, bool) { + if o == nil || IsNil(o.BillingCycle) { + return nil, false + } + return o.BillingCycle, true +} + +// HasBillingCycle returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasBillingCycle() bool { + if o != nil && !IsNil(o.BillingCycle) { + return true + } + + return false +} + +// SetBillingCycle gets a reference to the given DeviceCreateInputBillingCycle and assigns it to the BillingCycle field. +func (o *DeviceCreateInFacilityInput) SetBillingCycle(v DeviceCreateInputBillingCycle) { + o.BillingCycle = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *DeviceCreateInFacilityInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *DeviceCreateInFacilityInput) SetDescription(v string) { + o.Description = &v +} + +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetFeatures() []string { + if o == nil || IsNil(o.Features) { + var ret []string + return ret + } + return o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetFeaturesOk() ([]string, bool) { + if o == nil || IsNil(o.Features) { + return nil, false + } + return o.Features, true +} + +// HasFeatures returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasFeatures() bool { + if o != nil && !IsNil(o.Features) { + return true + } + + return false +} + +// SetFeatures gets a reference to the given []string and assigns it to the Features field. +func (o *DeviceCreateInFacilityInput) SetFeatures(v []string) { + o.Features = v +} + +// GetHardwareReservationId returns the HardwareReservationId field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetHardwareReservationId() string { + if o == nil || IsNil(o.HardwareReservationId) { + var ret string + return ret + } + return *o.HardwareReservationId +} + +// GetHardwareReservationIdOk returns a tuple with the HardwareReservationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetHardwareReservationIdOk() (*string, bool) { + if o == nil || IsNil(o.HardwareReservationId) { + return nil, false + } + return o.HardwareReservationId, true +} + +// HasHardwareReservationId returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasHardwareReservationId() bool { + if o != nil && !IsNil(o.HardwareReservationId) { + return true + } + + return false +} + +// SetHardwareReservationId gets a reference to the given string and assigns it to the HardwareReservationId field. +func (o *DeviceCreateInFacilityInput) SetHardwareReservationId(v string) { + o.HardwareReservationId = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetHostname() string { + if o == nil || IsNil(o.Hostname) { + var ret string + return ret + } + return *o.Hostname +} + +// GetHostnameOk returns a tuple with the Hostname field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetHostnameOk() (*string, bool) { + if o == nil || IsNil(o.Hostname) { + return nil, false + } + return o.Hostname, true +} + +// HasHostname returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasHostname() bool { + if o != nil && !IsNil(o.Hostname) { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *DeviceCreateInFacilityInput) SetHostname(v string) { + o.Hostname = &v +} + +// GetIpAddresses returns the IpAddresses field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetIpAddresses() []IPAddress { + if o == nil || IsNil(o.IpAddresses) { + var ret []IPAddress + return ret + } + return o.IpAddresses +} + +// GetIpAddressesOk returns a tuple with the IpAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetIpAddressesOk() ([]IPAddress, bool) { + if o == nil || IsNil(o.IpAddresses) { + return nil, false + } + return o.IpAddresses, true +} + +// HasIpAddresses returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasIpAddresses() bool { + if o != nil && !IsNil(o.IpAddresses) { + return true + } + + return false +} + +// SetIpAddresses gets a reference to the given []IPAddress and assigns it to the IpAddresses field. +func (o *DeviceCreateInFacilityInput) SetIpAddresses(v []IPAddress) { + o.IpAddresses = v +} + +// GetIpxeScriptUrl returns the IpxeScriptUrl field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetIpxeScriptUrl() string { + if o == nil || IsNil(o.IpxeScriptUrl) { + var ret string + return ret + } + return *o.IpxeScriptUrl +} + +// GetIpxeScriptUrlOk returns a tuple with the IpxeScriptUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetIpxeScriptUrlOk() (*string, bool) { + if o == nil || IsNil(o.IpxeScriptUrl) { + return nil, false + } + return o.IpxeScriptUrl, true +} + +// HasIpxeScriptUrl returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasIpxeScriptUrl() bool { + if o != nil && !IsNil(o.IpxeScriptUrl) { + return true + } + + return false +} + +// SetIpxeScriptUrl gets a reference to the given string and assigns it to the IpxeScriptUrl field. +func (o *DeviceCreateInFacilityInput) SetIpxeScriptUrl(v string) { + o.IpxeScriptUrl = &v +} + +// GetLocked returns the Locked field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetLocked() bool { + if o == nil || IsNil(o.Locked) { + var ret bool + return ret + } + return *o.Locked +} + +// GetLockedOk returns a tuple with the Locked field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetLockedOk() (*bool, bool) { + if o == nil || IsNil(o.Locked) { + return nil, false + } + return o.Locked, true +} + +// HasLocked returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasLocked() bool { + if o != nil && !IsNil(o.Locked) { + return true + } + + return false +} + +// SetLocked gets a reference to the given bool and assigns it to the Locked field. +func (o *DeviceCreateInFacilityInput) SetLocked(v bool) { + o.Locked = &v +} + +// GetNetworkFrozen returns the NetworkFrozen field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetNetworkFrozen() bool { + if o == nil || IsNil(o.NetworkFrozen) { + var ret bool + return ret + } + return *o.NetworkFrozen +} + +// GetNetworkFrozenOk returns a tuple with the NetworkFrozen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetNetworkFrozenOk() (*bool, bool) { + if o == nil || IsNil(o.NetworkFrozen) { + return nil, false + } + return o.NetworkFrozen, true +} + +// HasNetworkFrozen returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasNetworkFrozen() bool { + if o != nil && !IsNil(o.NetworkFrozen) { + return true + } + + return false +} + +// SetNetworkFrozen gets a reference to the given bool and assigns it to the NetworkFrozen field. +func (o *DeviceCreateInFacilityInput) SetNetworkFrozen(v bool) { + o.NetworkFrozen = &v +} + +// GetNoSshKeys returns the NoSshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetNoSshKeys() bool { + if o == nil || IsNil(o.NoSshKeys) { + var ret bool + return ret + } + return *o.NoSshKeys +} + +// GetNoSshKeysOk returns a tuple with the NoSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetNoSshKeysOk() (*bool, bool) { + if o == nil || IsNil(o.NoSshKeys) { + return nil, false + } + return o.NoSshKeys, true +} + +// HasNoSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasNoSshKeys() bool { + if o != nil && !IsNil(o.NoSshKeys) { + return true + } + + return false +} + +// SetNoSshKeys gets a reference to the given bool and assigns it to the NoSshKeys field. +func (o *DeviceCreateInFacilityInput) SetNoSshKeys(v bool) { + o.NoSshKeys = &v +} + +// GetOperatingSystem returns the OperatingSystem field value +func (o *DeviceCreateInFacilityInput) GetOperatingSystem() string { + if o == nil { + var ret string + return ret + } + + return o.OperatingSystem +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetOperatingSystemOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OperatingSystem, true +} + +// SetOperatingSystem sets field value +func (o *DeviceCreateInFacilityInput) SetOperatingSystem(v string) { + o.OperatingSystem = v +} + +// GetPlan returns the Plan field value +func (o *DeviceCreateInFacilityInput) GetPlan() string { + if o == nil { + var ret string + return ret + } + + return o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetPlanOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Plan, true +} + +// SetPlan sets field value +func (o *DeviceCreateInFacilityInput) SetPlan(v string) { + o.Plan = v +} + +// GetPrivateIpv4SubnetSize returns the PrivateIpv4SubnetSize field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetPrivateIpv4SubnetSize() int32 { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + var ret int32 + return ret + } + return *o.PrivateIpv4SubnetSize +} + +// GetPrivateIpv4SubnetSizeOk returns a tuple with the PrivateIpv4SubnetSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetPrivateIpv4SubnetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + return nil, false + } + return o.PrivateIpv4SubnetSize, true +} + +// HasPrivateIpv4SubnetSize returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasPrivateIpv4SubnetSize() bool { + if o != nil && !IsNil(o.PrivateIpv4SubnetSize) { + return true + } + + return false +} + +// SetPrivateIpv4SubnetSize gets a reference to the given int32 and assigns it to the PrivateIpv4SubnetSize field. +func (o *DeviceCreateInFacilityInput) SetPrivateIpv4SubnetSize(v int32) { + o.PrivateIpv4SubnetSize = &v +} + +// GetProjectSshKeys returns the ProjectSshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetProjectSshKeys() []string { + if o == nil || IsNil(o.ProjectSshKeys) { + var ret []string + return ret + } + return o.ProjectSshKeys +} + +// GetProjectSshKeysOk returns a tuple with the ProjectSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetProjectSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.ProjectSshKeys) { + return nil, false + } + return o.ProjectSshKeys, true +} + +// HasProjectSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasProjectSshKeys() bool { + if o != nil && !IsNil(o.ProjectSshKeys) { + return true + } + + return false +} + +// SetProjectSshKeys gets a reference to the given []string and assigns it to the ProjectSshKeys field. +func (o *DeviceCreateInFacilityInput) SetProjectSshKeys(v []string) { + o.ProjectSshKeys = v +} + +// GetPublicIpv4SubnetSize returns the PublicIpv4SubnetSize field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetPublicIpv4SubnetSize() int32 { + if o == nil || IsNil(o.PublicIpv4SubnetSize) { + var ret int32 + return ret + } + return *o.PublicIpv4SubnetSize +} + +// GetPublicIpv4SubnetSizeOk returns a tuple with the PublicIpv4SubnetSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetPublicIpv4SubnetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PublicIpv4SubnetSize) { + return nil, false + } + return o.PublicIpv4SubnetSize, true +} + +// HasPublicIpv4SubnetSize returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasPublicIpv4SubnetSize() bool { + if o != nil && !IsNil(o.PublicIpv4SubnetSize) { + return true + } + + return false +} + +// SetPublicIpv4SubnetSize gets a reference to the given int32 and assigns it to the PublicIpv4SubnetSize field. +func (o *DeviceCreateInFacilityInput) SetPublicIpv4SubnetSize(v int32) { + o.PublicIpv4SubnetSize = &v +} + +// GetSpotInstance returns the SpotInstance field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetSpotInstance() bool { + if o == nil || IsNil(o.SpotInstance) { + var ret bool + return ret + } + return *o.SpotInstance +} + +// GetSpotInstanceOk returns a tuple with the SpotInstance field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetSpotInstanceOk() (*bool, bool) { + if o == nil || IsNil(o.SpotInstance) { + return nil, false + } + return o.SpotInstance, true +} + +// HasSpotInstance returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasSpotInstance() bool { + if o != nil && !IsNil(o.SpotInstance) { + return true + } + + return false +} + +// SetSpotInstance gets a reference to the given bool and assigns it to the SpotInstance field. +func (o *DeviceCreateInFacilityInput) SetSpotInstance(v bool) { + o.SpotInstance = &v +} + +// GetSpotPriceMax returns the SpotPriceMax field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetSpotPriceMax() float32 { + if o == nil || IsNil(o.SpotPriceMax) { + var ret float32 + return ret + } + return *o.SpotPriceMax +} + +// GetSpotPriceMaxOk returns a tuple with the SpotPriceMax field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetSpotPriceMaxOk() (*float32, bool) { + if o == nil || IsNil(o.SpotPriceMax) { + return nil, false + } + return o.SpotPriceMax, true +} + +// HasSpotPriceMax returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasSpotPriceMax() bool { + if o != nil && !IsNil(o.SpotPriceMax) { + return true + } + + return false +} + +// SetSpotPriceMax gets a reference to the given float32 and assigns it to the SpotPriceMax field. +func (o *DeviceCreateInFacilityInput) SetSpotPriceMax(v float32) { + o.SpotPriceMax = &v +} + +// GetSshKeys returns the SshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetSshKeys() []SSHKeyInput { + if o == nil || IsNil(o.SshKeys) { + var ret []SSHKeyInput + return ret + } + return o.SshKeys +} + +// GetSshKeysOk returns a tuple with the SshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetSshKeysOk() ([]SSHKeyInput, bool) { + if o == nil || IsNil(o.SshKeys) { + return nil, false + } + return o.SshKeys, true +} + +// HasSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasSshKeys() bool { + if o != nil && !IsNil(o.SshKeys) { + return true + } + + return false +} + +// SetSshKeys gets a reference to the given []SSHKeyInput and assigns it to the SshKeys field. +func (o *DeviceCreateInFacilityInput) SetSshKeys(v []SSHKeyInput) { + o.SshKeys = v +} + +// GetStorage returns the Storage field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetStorage() Storage { + if o == nil || IsNil(o.Storage) { + var ret Storage + return ret + } + return *o.Storage +} + +// GetStorageOk returns a tuple with the Storage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetStorageOk() (*Storage, bool) { + if o == nil || IsNil(o.Storage) { + return nil, false + } + return o.Storage, true +} + +// HasStorage returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasStorage() bool { + if o != nil && !IsNil(o.Storage) { + return true + } + + return false +} + +// SetStorage gets a reference to the given Storage and assigns it to the Storage field. +func (o *DeviceCreateInFacilityInput) SetStorage(v Storage) { + o.Storage = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *DeviceCreateInFacilityInput) SetTags(v []string) { + o.Tags = v +} + +// GetTerminationTime returns the TerminationTime field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetTerminationTime() time.Time { + if o == nil || IsNil(o.TerminationTime) { + var ret time.Time + return ret + } + return *o.TerminationTime +} + +// GetTerminationTimeOk returns a tuple with the TerminationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetTerminationTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.TerminationTime) { + return nil, false + } + return o.TerminationTime, true +} + +// HasTerminationTime returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasTerminationTime() bool { + if o != nil && !IsNil(o.TerminationTime) { + return true + } + + return false +} + +// SetTerminationTime gets a reference to the given time.Time and assigns it to the TerminationTime field. +func (o *DeviceCreateInFacilityInput) SetTerminationTime(v time.Time) { + o.TerminationTime = &v +} + +// GetUserSshKeys returns the UserSshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetUserSshKeys() []string { + if o == nil || IsNil(o.UserSshKeys) { + var ret []string + return ret + } + return o.UserSshKeys +} + +// GetUserSshKeysOk returns a tuple with the UserSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetUserSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.UserSshKeys) { + return nil, false + } + return o.UserSshKeys, true +} + +// HasUserSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasUserSshKeys() bool { + if o != nil && !IsNil(o.UserSshKeys) { + return true + } + + return false +} + +// SetUserSshKeys gets a reference to the given []string and assigns it to the UserSshKeys field. +func (o *DeviceCreateInFacilityInput) SetUserSshKeys(v []string) { + o.UserSshKeys = v +} + +// GetUserdata returns the Userdata field value if set, zero value otherwise. +func (o *DeviceCreateInFacilityInput) GetUserdata() string { + if o == nil || IsNil(o.Userdata) { + var ret string + return ret + } + return *o.Userdata +} + +// GetUserdataOk returns a tuple with the Userdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInFacilityInput) GetUserdataOk() (*string, bool) { + if o == nil || IsNil(o.Userdata) { + return nil, false + } + return o.Userdata, true +} + +// HasUserdata returns a boolean if a field has been set. +func (o *DeviceCreateInFacilityInput) HasUserdata() bool { + if o != nil && !IsNil(o.Userdata) { + return true + } + + return false +} + +// SetUserdata gets a reference to the given string and assigns it to the Userdata field. +func (o *DeviceCreateInFacilityInput) SetUserdata(v string) { + o.Userdata = &v +} + +func (o DeviceCreateInFacilityInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceCreateInFacilityInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["facility"] = o.Facility + if !IsNil(o.AlwaysPxe) { + toSerialize["always_pxe"] = o.AlwaysPxe + } + if !IsNil(o.BillingCycle) { + toSerialize["billing_cycle"] = o.BillingCycle + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Features) { + toSerialize["features"] = o.Features + } + if !IsNil(o.HardwareReservationId) { + toSerialize["hardware_reservation_id"] = o.HardwareReservationId + } + if !IsNil(o.Hostname) { + toSerialize["hostname"] = o.Hostname + } + if !IsNil(o.IpAddresses) { + toSerialize["ip_addresses"] = o.IpAddresses + } + if !IsNil(o.IpxeScriptUrl) { + toSerialize["ipxe_script_url"] = o.IpxeScriptUrl + } + if !IsNil(o.Locked) { + toSerialize["locked"] = o.Locked + } + if !IsNil(o.NetworkFrozen) { + toSerialize["network_frozen"] = o.NetworkFrozen + } + if !IsNil(o.NoSshKeys) { + toSerialize["no_ssh_keys"] = o.NoSshKeys + } + toSerialize["operating_system"] = o.OperatingSystem + toSerialize["plan"] = o.Plan + if !IsNil(o.PrivateIpv4SubnetSize) { + toSerialize["private_ipv4_subnet_size"] = o.PrivateIpv4SubnetSize + } + if !IsNil(o.ProjectSshKeys) { + toSerialize["project_ssh_keys"] = o.ProjectSshKeys + } + if !IsNil(o.PublicIpv4SubnetSize) { + toSerialize["public_ipv4_subnet_size"] = o.PublicIpv4SubnetSize + } + if !IsNil(o.SpotInstance) { + toSerialize["spot_instance"] = o.SpotInstance + } + if !IsNil(o.SpotPriceMax) { + toSerialize["spot_price_max"] = o.SpotPriceMax + } + if !IsNil(o.SshKeys) { + toSerialize["ssh_keys"] = o.SshKeys + } + if !IsNil(o.Storage) { + toSerialize["storage"] = o.Storage + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.TerminationTime) { + toSerialize["termination_time"] = o.TerminationTime + } + if !IsNil(o.UserSshKeys) { + toSerialize["user_ssh_keys"] = o.UserSshKeys + } + if !IsNil(o.Userdata) { + toSerialize["userdata"] = o.Userdata + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceCreateInFacilityInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "facility", + "operating_system", + "plan", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varDeviceCreateInFacilityInput := _DeviceCreateInFacilityInput{} + + err = json.Unmarshal(data, &varDeviceCreateInFacilityInput) + + if err != nil { + return err + } + + *o = DeviceCreateInFacilityInput(varDeviceCreateInFacilityInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "facility") + delete(additionalProperties, "always_pxe") + delete(additionalProperties, "billing_cycle") + delete(additionalProperties, "customdata") + delete(additionalProperties, "description") + delete(additionalProperties, "features") + delete(additionalProperties, "hardware_reservation_id") + delete(additionalProperties, "hostname") + delete(additionalProperties, "ip_addresses") + delete(additionalProperties, "ipxe_script_url") + delete(additionalProperties, "locked") + delete(additionalProperties, "network_frozen") + delete(additionalProperties, "no_ssh_keys") + delete(additionalProperties, "operating_system") + delete(additionalProperties, "plan") + delete(additionalProperties, "private_ipv4_subnet_size") + delete(additionalProperties, "project_ssh_keys") + delete(additionalProperties, "public_ipv4_subnet_size") + delete(additionalProperties, "spot_instance") + delete(additionalProperties, "spot_price_max") + delete(additionalProperties, "ssh_keys") + delete(additionalProperties, "storage") + delete(additionalProperties, "tags") + delete(additionalProperties, "termination_time") + delete(additionalProperties, "user_ssh_keys") + delete(additionalProperties, "userdata") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceCreateInFacilityInput struct { + value *DeviceCreateInFacilityInput + isSet bool +} + +func (v NullableDeviceCreateInFacilityInput) Get() *DeviceCreateInFacilityInput { + return v.value +} + +func (v *NullableDeviceCreateInFacilityInput) Set(val *DeviceCreateInFacilityInput) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceCreateInFacilityInput) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceCreateInFacilityInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceCreateInFacilityInput(val *DeviceCreateInFacilityInput) *NullableDeviceCreateInFacilityInput { + return &NullableDeviceCreateInFacilityInput{value: val, isSet: true} +} + +func (v NullableDeviceCreateInFacilityInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceCreateInFacilityInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_in_metro_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_in_metro_input.go new file mode 100644 index 00000000..27ab704b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_in_metro_input.go @@ -0,0 +1,1124 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the DeviceCreateInMetroInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceCreateInMetroInput{} + +// DeviceCreateInMetroInput struct for DeviceCreateInMetroInput +type DeviceCreateInMetroInput struct { + // Metro code or ID of where the instance should be provisioned in. Either metro or facility must be provided. + Metro string `json:"metro"` + // When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot. + AlwaysPxe *bool `json:"always_pxe,omitempty"` + BillingCycle *DeviceCreateInputBillingCycle `json:"billing_cycle,omitempty"` + // Customdata is an arbitrary JSON value that can be accessed via the metadata service. + Customdata map[string]interface{} `json:"customdata,omitempty"` + // Any description of the device or how it will be used. This may be used to inform other API consumers with project access. + Description *string `json:"description,omitempty"` + // The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria. + Features []string `json:"features,omitempty"` + // The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details. + HardwareReservationId *string `json:"hardware_reservation_id,omitempty"` + // The hostname to use within the operating system. The same hostname may be used on multiple devices within a project. + Hostname *string `json:"hostname,omitempty"` + // The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled. + IpAddresses []IPAddress `json:"ip_addresses,omitempty"` + // When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details. + IpxeScriptUrl *string `json:"ipxe_script_url,omitempty"` + // Whether the device should be locked, preventing accidental deletion. + Locked *bool `json:"locked,omitempty"` + // If true, this instance can not be converted to a different network type. + NetworkFrozen *bool `json:"network_frozen,omitempty"` + // Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified + NoSshKeys *bool `json:"no_ssh_keys,omitempty"` + // The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans. + OperatingSystem string `json:"operating_system"` + // The slug of the device plan to provision. + Plan string `json:"plan"` + // Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. + PrivateIpv4SubnetSize *int32 `json:"private_ipv4_subnet_size,omitempty"` + // A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. + ProjectSshKeys []string `json:"project_ssh_keys,omitempty"` + // Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request. + PublicIpv4SubnetSize *int32 `json:"public_ipv4_subnet_size,omitempty"` + // Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field. + SpotInstance *bool `json:"spot_instance,omitempty"` + // The maximum amount to bid for a spot instance. + SpotPriceMax *float32 `json:"spot_price_max,omitempty"` + // A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. + SshKeys []SSHKeyInput `json:"ssh_keys,omitempty"` + Storage *Storage `json:"storage,omitempty"` + Tags []string `json:"tags,omitempty"` + // When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. + TerminationTime *time.Time `json:"termination_time,omitempty"` + // A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. + UserSshKeys []string `json:"user_ssh_keys,omitempty"` + // The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details. + Userdata *string `json:"userdata,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceCreateInMetroInput DeviceCreateInMetroInput + +// NewDeviceCreateInMetroInput instantiates a new DeviceCreateInMetroInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceCreateInMetroInput(metro string, operatingSystem string, plan string) *DeviceCreateInMetroInput { + this := DeviceCreateInMetroInput{} + this.Metro = metro + var alwaysPxe bool = false + this.AlwaysPxe = &alwaysPxe + var hardwareReservationId string = "" + this.HardwareReservationId = &hardwareReservationId + var locked bool = false + this.Locked = &locked + var noSshKeys bool = false + this.NoSshKeys = &noSshKeys + this.OperatingSystem = operatingSystem + this.Plan = plan + var privateIpv4SubnetSize int32 = 28 + this.PrivateIpv4SubnetSize = &privateIpv4SubnetSize + var publicIpv4SubnetSize int32 = 31 + this.PublicIpv4SubnetSize = &publicIpv4SubnetSize + return &this +} + +// NewDeviceCreateInMetroInputWithDefaults instantiates a new DeviceCreateInMetroInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceCreateInMetroInputWithDefaults() *DeviceCreateInMetroInput { + this := DeviceCreateInMetroInput{} + var alwaysPxe bool = false + this.AlwaysPxe = &alwaysPxe + var hardwareReservationId string = "" + this.HardwareReservationId = &hardwareReservationId + var locked bool = false + this.Locked = &locked + var noSshKeys bool = false + this.NoSshKeys = &noSshKeys + var privateIpv4SubnetSize int32 = 28 + this.PrivateIpv4SubnetSize = &privateIpv4SubnetSize + var publicIpv4SubnetSize int32 = 31 + this.PublicIpv4SubnetSize = &publicIpv4SubnetSize + return &this +} + +// GetMetro returns the Metro field value +func (o *DeviceCreateInMetroInput) GetMetro() string { + if o == nil { + var ret string + return ret + } + + return o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetMetroOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metro, true +} + +// SetMetro sets field value +func (o *DeviceCreateInMetroInput) SetMetro(v string) { + o.Metro = v +} + +// GetAlwaysPxe returns the AlwaysPxe field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetAlwaysPxe() bool { + if o == nil || IsNil(o.AlwaysPxe) { + var ret bool + return ret + } + return *o.AlwaysPxe +} + +// GetAlwaysPxeOk returns a tuple with the AlwaysPxe field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetAlwaysPxeOk() (*bool, bool) { + if o == nil || IsNil(o.AlwaysPxe) { + return nil, false + } + return o.AlwaysPxe, true +} + +// HasAlwaysPxe returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasAlwaysPxe() bool { + if o != nil && !IsNil(o.AlwaysPxe) { + return true + } + + return false +} + +// SetAlwaysPxe gets a reference to the given bool and assigns it to the AlwaysPxe field. +func (o *DeviceCreateInMetroInput) SetAlwaysPxe(v bool) { + o.AlwaysPxe = &v +} + +// GetBillingCycle returns the BillingCycle field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetBillingCycle() DeviceCreateInputBillingCycle { + if o == nil || IsNil(o.BillingCycle) { + var ret DeviceCreateInputBillingCycle + return ret + } + return *o.BillingCycle +} + +// GetBillingCycleOk returns a tuple with the BillingCycle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetBillingCycleOk() (*DeviceCreateInputBillingCycle, bool) { + if o == nil || IsNil(o.BillingCycle) { + return nil, false + } + return o.BillingCycle, true +} + +// HasBillingCycle returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasBillingCycle() bool { + if o != nil && !IsNil(o.BillingCycle) { + return true + } + + return false +} + +// SetBillingCycle gets a reference to the given DeviceCreateInputBillingCycle and assigns it to the BillingCycle field. +func (o *DeviceCreateInMetroInput) SetBillingCycle(v DeviceCreateInputBillingCycle) { + o.BillingCycle = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *DeviceCreateInMetroInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *DeviceCreateInMetroInput) SetDescription(v string) { + o.Description = &v +} + +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetFeatures() []string { + if o == nil || IsNil(o.Features) { + var ret []string + return ret + } + return o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetFeaturesOk() ([]string, bool) { + if o == nil || IsNil(o.Features) { + return nil, false + } + return o.Features, true +} + +// HasFeatures returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasFeatures() bool { + if o != nil && !IsNil(o.Features) { + return true + } + + return false +} + +// SetFeatures gets a reference to the given []string and assigns it to the Features field. +func (o *DeviceCreateInMetroInput) SetFeatures(v []string) { + o.Features = v +} + +// GetHardwareReservationId returns the HardwareReservationId field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetHardwareReservationId() string { + if o == nil || IsNil(o.HardwareReservationId) { + var ret string + return ret + } + return *o.HardwareReservationId +} + +// GetHardwareReservationIdOk returns a tuple with the HardwareReservationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetHardwareReservationIdOk() (*string, bool) { + if o == nil || IsNil(o.HardwareReservationId) { + return nil, false + } + return o.HardwareReservationId, true +} + +// HasHardwareReservationId returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasHardwareReservationId() bool { + if o != nil && !IsNil(o.HardwareReservationId) { + return true + } + + return false +} + +// SetHardwareReservationId gets a reference to the given string and assigns it to the HardwareReservationId field. +func (o *DeviceCreateInMetroInput) SetHardwareReservationId(v string) { + o.HardwareReservationId = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetHostname() string { + if o == nil || IsNil(o.Hostname) { + var ret string + return ret + } + return *o.Hostname +} + +// GetHostnameOk returns a tuple with the Hostname field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetHostnameOk() (*string, bool) { + if o == nil || IsNil(o.Hostname) { + return nil, false + } + return o.Hostname, true +} + +// HasHostname returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasHostname() bool { + if o != nil && !IsNil(o.Hostname) { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *DeviceCreateInMetroInput) SetHostname(v string) { + o.Hostname = &v +} + +// GetIpAddresses returns the IpAddresses field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetIpAddresses() []IPAddress { + if o == nil || IsNil(o.IpAddresses) { + var ret []IPAddress + return ret + } + return o.IpAddresses +} + +// GetIpAddressesOk returns a tuple with the IpAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetIpAddressesOk() ([]IPAddress, bool) { + if o == nil || IsNil(o.IpAddresses) { + return nil, false + } + return o.IpAddresses, true +} + +// HasIpAddresses returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasIpAddresses() bool { + if o != nil && !IsNil(o.IpAddresses) { + return true + } + + return false +} + +// SetIpAddresses gets a reference to the given []IPAddress and assigns it to the IpAddresses field. +func (o *DeviceCreateInMetroInput) SetIpAddresses(v []IPAddress) { + o.IpAddresses = v +} + +// GetIpxeScriptUrl returns the IpxeScriptUrl field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetIpxeScriptUrl() string { + if o == nil || IsNil(o.IpxeScriptUrl) { + var ret string + return ret + } + return *o.IpxeScriptUrl +} + +// GetIpxeScriptUrlOk returns a tuple with the IpxeScriptUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetIpxeScriptUrlOk() (*string, bool) { + if o == nil || IsNil(o.IpxeScriptUrl) { + return nil, false + } + return o.IpxeScriptUrl, true +} + +// HasIpxeScriptUrl returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasIpxeScriptUrl() bool { + if o != nil && !IsNil(o.IpxeScriptUrl) { + return true + } + + return false +} + +// SetIpxeScriptUrl gets a reference to the given string and assigns it to the IpxeScriptUrl field. +func (o *DeviceCreateInMetroInput) SetIpxeScriptUrl(v string) { + o.IpxeScriptUrl = &v +} + +// GetLocked returns the Locked field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetLocked() bool { + if o == nil || IsNil(o.Locked) { + var ret bool + return ret + } + return *o.Locked +} + +// GetLockedOk returns a tuple with the Locked field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetLockedOk() (*bool, bool) { + if o == nil || IsNil(o.Locked) { + return nil, false + } + return o.Locked, true +} + +// HasLocked returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasLocked() bool { + if o != nil && !IsNil(o.Locked) { + return true + } + + return false +} + +// SetLocked gets a reference to the given bool and assigns it to the Locked field. +func (o *DeviceCreateInMetroInput) SetLocked(v bool) { + o.Locked = &v +} + +// GetNetworkFrozen returns the NetworkFrozen field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetNetworkFrozen() bool { + if o == nil || IsNil(o.NetworkFrozen) { + var ret bool + return ret + } + return *o.NetworkFrozen +} + +// GetNetworkFrozenOk returns a tuple with the NetworkFrozen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetNetworkFrozenOk() (*bool, bool) { + if o == nil || IsNil(o.NetworkFrozen) { + return nil, false + } + return o.NetworkFrozen, true +} + +// HasNetworkFrozen returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasNetworkFrozen() bool { + if o != nil && !IsNil(o.NetworkFrozen) { + return true + } + + return false +} + +// SetNetworkFrozen gets a reference to the given bool and assigns it to the NetworkFrozen field. +func (o *DeviceCreateInMetroInput) SetNetworkFrozen(v bool) { + o.NetworkFrozen = &v +} + +// GetNoSshKeys returns the NoSshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetNoSshKeys() bool { + if o == nil || IsNil(o.NoSshKeys) { + var ret bool + return ret + } + return *o.NoSshKeys +} + +// GetNoSshKeysOk returns a tuple with the NoSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetNoSshKeysOk() (*bool, bool) { + if o == nil || IsNil(o.NoSshKeys) { + return nil, false + } + return o.NoSshKeys, true +} + +// HasNoSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasNoSshKeys() bool { + if o != nil && !IsNil(o.NoSshKeys) { + return true + } + + return false +} + +// SetNoSshKeys gets a reference to the given bool and assigns it to the NoSshKeys field. +func (o *DeviceCreateInMetroInput) SetNoSshKeys(v bool) { + o.NoSshKeys = &v +} + +// GetOperatingSystem returns the OperatingSystem field value +func (o *DeviceCreateInMetroInput) GetOperatingSystem() string { + if o == nil { + var ret string + return ret + } + + return o.OperatingSystem +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetOperatingSystemOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OperatingSystem, true +} + +// SetOperatingSystem sets field value +func (o *DeviceCreateInMetroInput) SetOperatingSystem(v string) { + o.OperatingSystem = v +} + +// GetPlan returns the Plan field value +func (o *DeviceCreateInMetroInput) GetPlan() string { + if o == nil { + var ret string + return ret + } + + return o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetPlanOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Plan, true +} + +// SetPlan sets field value +func (o *DeviceCreateInMetroInput) SetPlan(v string) { + o.Plan = v +} + +// GetPrivateIpv4SubnetSize returns the PrivateIpv4SubnetSize field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetPrivateIpv4SubnetSize() int32 { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + var ret int32 + return ret + } + return *o.PrivateIpv4SubnetSize +} + +// GetPrivateIpv4SubnetSizeOk returns a tuple with the PrivateIpv4SubnetSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetPrivateIpv4SubnetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + return nil, false + } + return o.PrivateIpv4SubnetSize, true +} + +// HasPrivateIpv4SubnetSize returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasPrivateIpv4SubnetSize() bool { + if o != nil && !IsNil(o.PrivateIpv4SubnetSize) { + return true + } + + return false +} + +// SetPrivateIpv4SubnetSize gets a reference to the given int32 and assigns it to the PrivateIpv4SubnetSize field. +func (o *DeviceCreateInMetroInput) SetPrivateIpv4SubnetSize(v int32) { + o.PrivateIpv4SubnetSize = &v +} + +// GetProjectSshKeys returns the ProjectSshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetProjectSshKeys() []string { + if o == nil || IsNil(o.ProjectSshKeys) { + var ret []string + return ret + } + return o.ProjectSshKeys +} + +// GetProjectSshKeysOk returns a tuple with the ProjectSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetProjectSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.ProjectSshKeys) { + return nil, false + } + return o.ProjectSshKeys, true +} + +// HasProjectSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasProjectSshKeys() bool { + if o != nil && !IsNil(o.ProjectSshKeys) { + return true + } + + return false +} + +// SetProjectSshKeys gets a reference to the given []string and assigns it to the ProjectSshKeys field. +func (o *DeviceCreateInMetroInput) SetProjectSshKeys(v []string) { + o.ProjectSshKeys = v +} + +// GetPublicIpv4SubnetSize returns the PublicIpv4SubnetSize field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetPublicIpv4SubnetSize() int32 { + if o == nil || IsNil(o.PublicIpv4SubnetSize) { + var ret int32 + return ret + } + return *o.PublicIpv4SubnetSize +} + +// GetPublicIpv4SubnetSizeOk returns a tuple with the PublicIpv4SubnetSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetPublicIpv4SubnetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PublicIpv4SubnetSize) { + return nil, false + } + return o.PublicIpv4SubnetSize, true +} + +// HasPublicIpv4SubnetSize returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasPublicIpv4SubnetSize() bool { + if o != nil && !IsNil(o.PublicIpv4SubnetSize) { + return true + } + + return false +} + +// SetPublicIpv4SubnetSize gets a reference to the given int32 and assigns it to the PublicIpv4SubnetSize field. +func (o *DeviceCreateInMetroInput) SetPublicIpv4SubnetSize(v int32) { + o.PublicIpv4SubnetSize = &v +} + +// GetSpotInstance returns the SpotInstance field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetSpotInstance() bool { + if o == nil || IsNil(o.SpotInstance) { + var ret bool + return ret + } + return *o.SpotInstance +} + +// GetSpotInstanceOk returns a tuple with the SpotInstance field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetSpotInstanceOk() (*bool, bool) { + if o == nil || IsNil(o.SpotInstance) { + return nil, false + } + return o.SpotInstance, true +} + +// HasSpotInstance returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasSpotInstance() bool { + if o != nil && !IsNil(o.SpotInstance) { + return true + } + + return false +} + +// SetSpotInstance gets a reference to the given bool and assigns it to the SpotInstance field. +func (o *DeviceCreateInMetroInput) SetSpotInstance(v bool) { + o.SpotInstance = &v +} + +// GetSpotPriceMax returns the SpotPriceMax field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetSpotPriceMax() float32 { + if o == nil || IsNil(o.SpotPriceMax) { + var ret float32 + return ret + } + return *o.SpotPriceMax +} + +// GetSpotPriceMaxOk returns a tuple with the SpotPriceMax field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetSpotPriceMaxOk() (*float32, bool) { + if o == nil || IsNil(o.SpotPriceMax) { + return nil, false + } + return o.SpotPriceMax, true +} + +// HasSpotPriceMax returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasSpotPriceMax() bool { + if o != nil && !IsNil(o.SpotPriceMax) { + return true + } + + return false +} + +// SetSpotPriceMax gets a reference to the given float32 and assigns it to the SpotPriceMax field. +func (o *DeviceCreateInMetroInput) SetSpotPriceMax(v float32) { + o.SpotPriceMax = &v +} + +// GetSshKeys returns the SshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetSshKeys() []SSHKeyInput { + if o == nil || IsNil(o.SshKeys) { + var ret []SSHKeyInput + return ret + } + return o.SshKeys +} + +// GetSshKeysOk returns a tuple with the SshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetSshKeysOk() ([]SSHKeyInput, bool) { + if o == nil || IsNil(o.SshKeys) { + return nil, false + } + return o.SshKeys, true +} + +// HasSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasSshKeys() bool { + if o != nil && !IsNil(o.SshKeys) { + return true + } + + return false +} + +// SetSshKeys gets a reference to the given []SSHKeyInput and assigns it to the SshKeys field. +func (o *DeviceCreateInMetroInput) SetSshKeys(v []SSHKeyInput) { + o.SshKeys = v +} + +// GetStorage returns the Storage field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetStorage() Storage { + if o == nil || IsNil(o.Storage) { + var ret Storage + return ret + } + return *o.Storage +} + +// GetStorageOk returns a tuple with the Storage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetStorageOk() (*Storage, bool) { + if o == nil || IsNil(o.Storage) { + return nil, false + } + return o.Storage, true +} + +// HasStorage returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasStorage() bool { + if o != nil && !IsNil(o.Storage) { + return true + } + + return false +} + +// SetStorage gets a reference to the given Storage and assigns it to the Storage field. +func (o *DeviceCreateInMetroInput) SetStorage(v Storage) { + o.Storage = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *DeviceCreateInMetroInput) SetTags(v []string) { + o.Tags = v +} + +// GetTerminationTime returns the TerminationTime field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetTerminationTime() time.Time { + if o == nil || IsNil(o.TerminationTime) { + var ret time.Time + return ret + } + return *o.TerminationTime +} + +// GetTerminationTimeOk returns a tuple with the TerminationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetTerminationTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.TerminationTime) { + return nil, false + } + return o.TerminationTime, true +} + +// HasTerminationTime returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasTerminationTime() bool { + if o != nil && !IsNil(o.TerminationTime) { + return true + } + + return false +} + +// SetTerminationTime gets a reference to the given time.Time and assigns it to the TerminationTime field. +func (o *DeviceCreateInMetroInput) SetTerminationTime(v time.Time) { + o.TerminationTime = &v +} + +// GetUserSshKeys returns the UserSshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetUserSshKeys() []string { + if o == nil || IsNil(o.UserSshKeys) { + var ret []string + return ret + } + return o.UserSshKeys +} + +// GetUserSshKeysOk returns a tuple with the UserSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetUserSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.UserSshKeys) { + return nil, false + } + return o.UserSshKeys, true +} + +// HasUserSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasUserSshKeys() bool { + if o != nil && !IsNil(o.UserSshKeys) { + return true + } + + return false +} + +// SetUserSshKeys gets a reference to the given []string and assigns it to the UserSshKeys field. +func (o *DeviceCreateInMetroInput) SetUserSshKeys(v []string) { + o.UserSshKeys = v +} + +// GetUserdata returns the Userdata field value if set, zero value otherwise. +func (o *DeviceCreateInMetroInput) GetUserdata() string { + if o == nil || IsNil(o.Userdata) { + var ret string + return ret + } + return *o.Userdata +} + +// GetUserdataOk returns a tuple with the Userdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInMetroInput) GetUserdataOk() (*string, bool) { + if o == nil || IsNil(o.Userdata) { + return nil, false + } + return o.Userdata, true +} + +// HasUserdata returns a boolean if a field has been set. +func (o *DeviceCreateInMetroInput) HasUserdata() bool { + if o != nil && !IsNil(o.Userdata) { + return true + } + + return false +} + +// SetUserdata gets a reference to the given string and assigns it to the Userdata field. +func (o *DeviceCreateInMetroInput) SetUserdata(v string) { + o.Userdata = &v +} + +func (o DeviceCreateInMetroInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceCreateInMetroInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["metro"] = o.Metro + if !IsNil(o.AlwaysPxe) { + toSerialize["always_pxe"] = o.AlwaysPxe + } + if !IsNil(o.BillingCycle) { + toSerialize["billing_cycle"] = o.BillingCycle + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Features) { + toSerialize["features"] = o.Features + } + if !IsNil(o.HardwareReservationId) { + toSerialize["hardware_reservation_id"] = o.HardwareReservationId + } + if !IsNil(o.Hostname) { + toSerialize["hostname"] = o.Hostname + } + if !IsNil(o.IpAddresses) { + toSerialize["ip_addresses"] = o.IpAddresses + } + if !IsNil(o.IpxeScriptUrl) { + toSerialize["ipxe_script_url"] = o.IpxeScriptUrl + } + if !IsNil(o.Locked) { + toSerialize["locked"] = o.Locked + } + if !IsNil(o.NetworkFrozen) { + toSerialize["network_frozen"] = o.NetworkFrozen + } + if !IsNil(o.NoSshKeys) { + toSerialize["no_ssh_keys"] = o.NoSshKeys + } + toSerialize["operating_system"] = o.OperatingSystem + toSerialize["plan"] = o.Plan + if !IsNil(o.PrivateIpv4SubnetSize) { + toSerialize["private_ipv4_subnet_size"] = o.PrivateIpv4SubnetSize + } + if !IsNil(o.ProjectSshKeys) { + toSerialize["project_ssh_keys"] = o.ProjectSshKeys + } + if !IsNil(o.PublicIpv4SubnetSize) { + toSerialize["public_ipv4_subnet_size"] = o.PublicIpv4SubnetSize + } + if !IsNil(o.SpotInstance) { + toSerialize["spot_instance"] = o.SpotInstance + } + if !IsNil(o.SpotPriceMax) { + toSerialize["spot_price_max"] = o.SpotPriceMax + } + if !IsNil(o.SshKeys) { + toSerialize["ssh_keys"] = o.SshKeys + } + if !IsNil(o.Storage) { + toSerialize["storage"] = o.Storage + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.TerminationTime) { + toSerialize["termination_time"] = o.TerminationTime + } + if !IsNil(o.UserSshKeys) { + toSerialize["user_ssh_keys"] = o.UserSshKeys + } + if !IsNil(o.Userdata) { + toSerialize["userdata"] = o.Userdata + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceCreateInMetroInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "metro", + "operating_system", + "plan", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varDeviceCreateInMetroInput := _DeviceCreateInMetroInput{} + + err = json.Unmarshal(data, &varDeviceCreateInMetroInput) + + if err != nil { + return err + } + + *o = DeviceCreateInMetroInput(varDeviceCreateInMetroInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "metro") + delete(additionalProperties, "always_pxe") + delete(additionalProperties, "billing_cycle") + delete(additionalProperties, "customdata") + delete(additionalProperties, "description") + delete(additionalProperties, "features") + delete(additionalProperties, "hardware_reservation_id") + delete(additionalProperties, "hostname") + delete(additionalProperties, "ip_addresses") + delete(additionalProperties, "ipxe_script_url") + delete(additionalProperties, "locked") + delete(additionalProperties, "network_frozen") + delete(additionalProperties, "no_ssh_keys") + delete(additionalProperties, "operating_system") + delete(additionalProperties, "plan") + delete(additionalProperties, "private_ipv4_subnet_size") + delete(additionalProperties, "project_ssh_keys") + delete(additionalProperties, "public_ipv4_subnet_size") + delete(additionalProperties, "spot_instance") + delete(additionalProperties, "spot_price_max") + delete(additionalProperties, "ssh_keys") + delete(additionalProperties, "storage") + delete(additionalProperties, "tags") + delete(additionalProperties, "termination_time") + delete(additionalProperties, "user_ssh_keys") + delete(additionalProperties, "userdata") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceCreateInMetroInput struct { + value *DeviceCreateInMetroInput + isSet bool +} + +func (v NullableDeviceCreateInMetroInput) Get() *DeviceCreateInMetroInput { + return v.value +} + +func (v *NullableDeviceCreateInMetroInput) Set(val *DeviceCreateInMetroInput) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceCreateInMetroInput) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceCreateInMetroInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceCreateInMetroInput(val *DeviceCreateInMetroInput) *NullableDeviceCreateInMetroInput { + return &NullableDeviceCreateInMetroInput{value: val, isSet: true} +} + +func (v NullableDeviceCreateInMetroInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceCreateInMetroInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_input.go new file mode 100644 index 00000000..92a087bd --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_input.go @@ -0,0 +1,1094 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the DeviceCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceCreateInput{} + +// DeviceCreateInput struct for DeviceCreateInput +type DeviceCreateInput struct { + // When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot. + AlwaysPxe *bool `json:"always_pxe,omitempty"` + BillingCycle *DeviceCreateInputBillingCycle `json:"billing_cycle,omitempty"` + // Customdata is an arbitrary JSON value that can be accessed via the metadata service. + Customdata map[string]interface{} `json:"customdata,omitempty"` + // Any description of the device or how it will be used. This may be used to inform other API consumers with project access. + Description *string `json:"description,omitempty"` + // The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria. + Features []string `json:"features,omitempty"` + // The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details. + HardwareReservationId *string `json:"hardware_reservation_id,omitempty"` + // The hostname to use within the operating system. The same hostname may be used on multiple devices within a project. + Hostname *string `json:"hostname,omitempty"` + // The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled. + IpAddresses []IPAddress `json:"ip_addresses,omitempty"` + // When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details. + IpxeScriptUrl *string `json:"ipxe_script_url,omitempty"` + // Whether the device should be locked, preventing accidental deletion. + Locked *bool `json:"locked,omitempty"` + // If true, this instance can not be converted to a different network type. + NetworkFrozen *bool `json:"network_frozen,omitempty"` + // Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified + NoSshKeys *bool `json:"no_ssh_keys,omitempty"` + // The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans. + OperatingSystem string `json:"operating_system"` + // The slug of the device plan to provision. + Plan string `json:"plan"` + // Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. + PrivateIpv4SubnetSize *int32 `json:"private_ipv4_subnet_size,omitempty"` + // A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. + ProjectSshKeys []string `json:"project_ssh_keys,omitempty"` + // Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request. + PublicIpv4SubnetSize *int32 `json:"public_ipv4_subnet_size,omitempty"` + // Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field. + SpotInstance *bool `json:"spot_instance,omitempty"` + // The maximum amount to bid for a spot instance. + SpotPriceMax *float32 `json:"spot_price_max,omitempty"` + // A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. + SshKeys []SSHKeyInput `json:"ssh_keys,omitempty"` + Storage *Storage `json:"storage,omitempty"` + Tags []string `json:"tags,omitempty"` + // When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. + TerminationTime *time.Time `json:"termination_time,omitempty"` + // A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. + UserSshKeys []string `json:"user_ssh_keys,omitempty"` + // The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details. + Userdata *string `json:"userdata,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceCreateInput DeviceCreateInput + +// NewDeviceCreateInput instantiates a new DeviceCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceCreateInput(operatingSystem string, plan string) *DeviceCreateInput { + this := DeviceCreateInput{} + var alwaysPxe bool = false + this.AlwaysPxe = &alwaysPxe + var hardwareReservationId string = "" + this.HardwareReservationId = &hardwareReservationId + var locked bool = false + this.Locked = &locked + var noSshKeys bool = false + this.NoSshKeys = &noSshKeys + this.OperatingSystem = operatingSystem + this.Plan = plan + var privateIpv4SubnetSize int32 = 28 + this.PrivateIpv4SubnetSize = &privateIpv4SubnetSize + var publicIpv4SubnetSize int32 = 31 + this.PublicIpv4SubnetSize = &publicIpv4SubnetSize + return &this +} + +// NewDeviceCreateInputWithDefaults instantiates a new DeviceCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceCreateInputWithDefaults() *DeviceCreateInput { + this := DeviceCreateInput{} + var alwaysPxe bool = false + this.AlwaysPxe = &alwaysPxe + var hardwareReservationId string = "" + this.HardwareReservationId = &hardwareReservationId + var locked bool = false + this.Locked = &locked + var noSshKeys bool = false + this.NoSshKeys = &noSshKeys + var privateIpv4SubnetSize int32 = 28 + this.PrivateIpv4SubnetSize = &privateIpv4SubnetSize + var publicIpv4SubnetSize int32 = 31 + this.PublicIpv4SubnetSize = &publicIpv4SubnetSize + return &this +} + +// GetAlwaysPxe returns the AlwaysPxe field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetAlwaysPxe() bool { + if o == nil || IsNil(o.AlwaysPxe) { + var ret bool + return ret + } + return *o.AlwaysPxe +} + +// GetAlwaysPxeOk returns a tuple with the AlwaysPxe field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetAlwaysPxeOk() (*bool, bool) { + if o == nil || IsNil(o.AlwaysPxe) { + return nil, false + } + return o.AlwaysPxe, true +} + +// HasAlwaysPxe returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasAlwaysPxe() bool { + if o != nil && !IsNil(o.AlwaysPxe) { + return true + } + + return false +} + +// SetAlwaysPxe gets a reference to the given bool and assigns it to the AlwaysPxe field. +func (o *DeviceCreateInput) SetAlwaysPxe(v bool) { + o.AlwaysPxe = &v +} + +// GetBillingCycle returns the BillingCycle field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetBillingCycle() DeviceCreateInputBillingCycle { + if o == nil || IsNil(o.BillingCycle) { + var ret DeviceCreateInputBillingCycle + return ret + } + return *o.BillingCycle +} + +// GetBillingCycleOk returns a tuple with the BillingCycle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetBillingCycleOk() (*DeviceCreateInputBillingCycle, bool) { + if o == nil || IsNil(o.BillingCycle) { + return nil, false + } + return o.BillingCycle, true +} + +// HasBillingCycle returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasBillingCycle() bool { + if o != nil && !IsNil(o.BillingCycle) { + return true + } + + return false +} + +// SetBillingCycle gets a reference to the given DeviceCreateInputBillingCycle and assigns it to the BillingCycle field. +func (o *DeviceCreateInput) SetBillingCycle(v DeviceCreateInputBillingCycle) { + o.BillingCycle = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *DeviceCreateInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *DeviceCreateInput) SetDescription(v string) { + o.Description = &v +} + +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetFeatures() []string { + if o == nil || IsNil(o.Features) { + var ret []string + return ret + } + return o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetFeaturesOk() ([]string, bool) { + if o == nil || IsNil(o.Features) { + return nil, false + } + return o.Features, true +} + +// HasFeatures returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasFeatures() bool { + if o != nil && !IsNil(o.Features) { + return true + } + + return false +} + +// SetFeatures gets a reference to the given []string and assigns it to the Features field. +func (o *DeviceCreateInput) SetFeatures(v []string) { + o.Features = v +} + +// GetHardwareReservationId returns the HardwareReservationId field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetHardwareReservationId() string { + if o == nil || IsNil(o.HardwareReservationId) { + var ret string + return ret + } + return *o.HardwareReservationId +} + +// GetHardwareReservationIdOk returns a tuple with the HardwareReservationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetHardwareReservationIdOk() (*string, bool) { + if o == nil || IsNil(o.HardwareReservationId) { + return nil, false + } + return o.HardwareReservationId, true +} + +// HasHardwareReservationId returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasHardwareReservationId() bool { + if o != nil && !IsNil(o.HardwareReservationId) { + return true + } + + return false +} + +// SetHardwareReservationId gets a reference to the given string and assigns it to the HardwareReservationId field. +func (o *DeviceCreateInput) SetHardwareReservationId(v string) { + o.HardwareReservationId = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetHostname() string { + if o == nil || IsNil(o.Hostname) { + var ret string + return ret + } + return *o.Hostname +} + +// GetHostnameOk returns a tuple with the Hostname field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetHostnameOk() (*string, bool) { + if o == nil || IsNil(o.Hostname) { + return nil, false + } + return o.Hostname, true +} + +// HasHostname returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasHostname() bool { + if o != nil && !IsNil(o.Hostname) { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *DeviceCreateInput) SetHostname(v string) { + o.Hostname = &v +} + +// GetIpAddresses returns the IpAddresses field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetIpAddresses() []IPAddress { + if o == nil || IsNil(o.IpAddresses) { + var ret []IPAddress + return ret + } + return o.IpAddresses +} + +// GetIpAddressesOk returns a tuple with the IpAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetIpAddressesOk() ([]IPAddress, bool) { + if o == nil || IsNil(o.IpAddresses) { + return nil, false + } + return o.IpAddresses, true +} + +// HasIpAddresses returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasIpAddresses() bool { + if o != nil && !IsNil(o.IpAddresses) { + return true + } + + return false +} + +// SetIpAddresses gets a reference to the given []IPAddress and assigns it to the IpAddresses field. +func (o *DeviceCreateInput) SetIpAddresses(v []IPAddress) { + o.IpAddresses = v +} + +// GetIpxeScriptUrl returns the IpxeScriptUrl field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetIpxeScriptUrl() string { + if o == nil || IsNil(o.IpxeScriptUrl) { + var ret string + return ret + } + return *o.IpxeScriptUrl +} + +// GetIpxeScriptUrlOk returns a tuple with the IpxeScriptUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetIpxeScriptUrlOk() (*string, bool) { + if o == nil || IsNil(o.IpxeScriptUrl) { + return nil, false + } + return o.IpxeScriptUrl, true +} + +// HasIpxeScriptUrl returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasIpxeScriptUrl() bool { + if o != nil && !IsNil(o.IpxeScriptUrl) { + return true + } + + return false +} + +// SetIpxeScriptUrl gets a reference to the given string and assigns it to the IpxeScriptUrl field. +func (o *DeviceCreateInput) SetIpxeScriptUrl(v string) { + o.IpxeScriptUrl = &v +} + +// GetLocked returns the Locked field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetLocked() bool { + if o == nil || IsNil(o.Locked) { + var ret bool + return ret + } + return *o.Locked +} + +// GetLockedOk returns a tuple with the Locked field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetLockedOk() (*bool, bool) { + if o == nil || IsNil(o.Locked) { + return nil, false + } + return o.Locked, true +} + +// HasLocked returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasLocked() bool { + if o != nil && !IsNil(o.Locked) { + return true + } + + return false +} + +// SetLocked gets a reference to the given bool and assigns it to the Locked field. +func (o *DeviceCreateInput) SetLocked(v bool) { + o.Locked = &v +} + +// GetNetworkFrozen returns the NetworkFrozen field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetNetworkFrozen() bool { + if o == nil || IsNil(o.NetworkFrozen) { + var ret bool + return ret + } + return *o.NetworkFrozen +} + +// GetNetworkFrozenOk returns a tuple with the NetworkFrozen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetNetworkFrozenOk() (*bool, bool) { + if o == nil || IsNil(o.NetworkFrozen) { + return nil, false + } + return o.NetworkFrozen, true +} + +// HasNetworkFrozen returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasNetworkFrozen() bool { + if o != nil && !IsNil(o.NetworkFrozen) { + return true + } + + return false +} + +// SetNetworkFrozen gets a reference to the given bool and assigns it to the NetworkFrozen field. +func (o *DeviceCreateInput) SetNetworkFrozen(v bool) { + o.NetworkFrozen = &v +} + +// GetNoSshKeys returns the NoSshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetNoSshKeys() bool { + if o == nil || IsNil(o.NoSshKeys) { + var ret bool + return ret + } + return *o.NoSshKeys +} + +// GetNoSshKeysOk returns a tuple with the NoSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetNoSshKeysOk() (*bool, bool) { + if o == nil || IsNil(o.NoSshKeys) { + return nil, false + } + return o.NoSshKeys, true +} + +// HasNoSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasNoSshKeys() bool { + if o != nil && !IsNil(o.NoSshKeys) { + return true + } + + return false +} + +// SetNoSshKeys gets a reference to the given bool and assigns it to the NoSshKeys field. +func (o *DeviceCreateInput) SetNoSshKeys(v bool) { + o.NoSshKeys = &v +} + +// GetOperatingSystem returns the OperatingSystem field value +func (o *DeviceCreateInput) GetOperatingSystem() string { + if o == nil { + var ret string + return ret + } + + return o.OperatingSystem +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetOperatingSystemOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OperatingSystem, true +} + +// SetOperatingSystem sets field value +func (o *DeviceCreateInput) SetOperatingSystem(v string) { + o.OperatingSystem = v +} + +// GetPlan returns the Plan field value +func (o *DeviceCreateInput) GetPlan() string { + if o == nil { + var ret string + return ret + } + + return o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetPlanOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Plan, true +} + +// SetPlan sets field value +func (o *DeviceCreateInput) SetPlan(v string) { + o.Plan = v +} + +// GetPrivateIpv4SubnetSize returns the PrivateIpv4SubnetSize field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetPrivateIpv4SubnetSize() int32 { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + var ret int32 + return ret + } + return *o.PrivateIpv4SubnetSize +} + +// GetPrivateIpv4SubnetSizeOk returns a tuple with the PrivateIpv4SubnetSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetPrivateIpv4SubnetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + return nil, false + } + return o.PrivateIpv4SubnetSize, true +} + +// HasPrivateIpv4SubnetSize returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasPrivateIpv4SubnetSize() bool { + if o != nil && !IsNil(o.PrivateIpv4SubnetSize) { + return true + } + + return false +} + +// SetPrivateIpv4SubnetSize gets a reference to the given int32 and assigns it to the PrivateIpv4SubnetSize field. +func (o *DeviceCreateInput) SetPrivateIpv4SubnetSize(v int32) { + o.PrivateIpv4SubnetSize = &v +} + +// GetProjectSshKeys returns the ProjectSshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetProjectSshKeys() []string { + if o == nil || IsNil(o.ProjectSshKeys) { + var ret []string + return ret + } + return o.ProjectSshKeys +} + +// GetProjectSshKeysOk returns a tuple with the ProjectSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetProjectSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.ProjectSshKeys) { + return nil, false + } + return o.ProjectSshKeys, true +} + +// HasProjectSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasProjectSshKeys() bool { + if o != nil && !IsNil(o.ProjectSshKeys) { + return true + } + + return false +} + +// SetProjectSshKeys gets a reference to the given []string and assigns it to the ProjectSshKeys field. +func (o *DeviceCreateInput) SetProjectSshKeys(v []string) { + o.ProjectSshKeys = v +} + +// GetPublicIpv4SubnetSize returns the PublicIpv4SubnetSize field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetPublicIpv4SubnetSize() int32 { + if o == nil || IsNil(o.PublicIpv4SubnetSize) { + var ret int32 + return ret + } + return *o.PublicIpv4SubnetSize +} + +// GetPublicIpv4SubnetSizeOk returns a tuple with the PublicIpv4SubnetSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetPublicIpv4SubnetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PublicIpv4SubnetSize) { + return nil, false + } + return o.PublicIpv4SubnetSize, true +} + +// HasPublicIpv4SubnetSize returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasPublicIpv4SubnetSize() bool { + if o != nil && !IsNil(o.PublicIpv4SubnetSize) { + return true + } + + return false +} + +// SetPublicIpv4SubnetSize gets a reference to the given int32 and assigns it to the PublicIpv4SubnetSize field. +func (o *DeviceCreateInput) SetPublicIpv4SubnetSize(v int32) { + o.PublicIpv4SubnetSize = &v +} + +// GetSpotInstance returns the SpotInstance field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetSpotInstance() bool { + if o == nil || IsNil(o.SpotInstance) { + var ret bool + return ret + } + return *o.SpotInstance +} + +// GetSpotInstanceOk returns a tuple with the SpotInstance field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetSpotInstanceOk() (*bool, bool) { + if o == nil || IsNil(o.SpotInstance) { + return nil, false + } + return o.SpotInstance, true +} + +// HasSpotInstance returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasSpotInstance() bool { + if o != nil && !IsNil(o.SpotInstance) { + return true + } + + return false +} + +// SetSpotInstance gets a reference to the given bool and assigns it to the SpotInstance field. +func (o *DeviceCreateInput) SetSpotInstance(v bool) { + o.SpotInstance = &v +} + +// GetSpotPriceMax returns the SpotPriceMax field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetSpotPriceMax() float32 { + if o == nil || IsNil(o.SpotPriceMax) { + var ret float32 + return ret + } + return *o.SpotPriceMax +} + +// GetSpotPriceMaxOk returns a tuple with the SpotPriceMax field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetSpotPriceMaxOk() (*float32, bool) { + if o == nil || IsNil(o.SpotPriceMax) { + return nil, false + } + return o.SpotPriceMax, true +} + +// HasSpotPriceMax returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasSpotPriceMax() bool { + if o != nil && !IsNil(o.SpotPriceMax) { + return true + } + + return false +} + +// SetSpotPriceMax gets a reference to the given float32 and assigns it to the SpotPriceMax field. +func (o *DeviceCreateInput) SetSpotPriceMax(v float32) { + o.SpotPriceMax = &v +} + +// GetSshKeys returns the SshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetSshKeys() []SSHKeyInput { + if o == nil || IsNil(o.SshKeys) { + var ret []SSHKeyInput + return ret + } + return o.SshKeys +} + +// GetSshKeysOk returns a tuple with the SshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetSshKeysOk() ([]SSHKeyInput, bool) { + if o == nil || IsNil(o.SshKeys) { + return nil, false + } + return o.SshKeys, true +} + +// HasSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasSshKeys() bool { + if o != nil && !IsNil(o.SshKeys) { + return true + } + + return false +} + +// SetSshKeys gets a reference to the given []SSHKeyInput and assigns it to the SshKeys field. +func (o *DeviceCreateInput) SetSshKeys(v []SSHKeyInput) { + o.SshKeys = v +} + +// GetStorage returns the Storage field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetStorage() Storage { + if o == nil || IsNil(o.Storage) { + var ret Storage + return ret + } + return *o.Storage +} + +// GetStorageOk returns a tuple with the Storage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetStorageOk() (*Storage, bool) { + if o == nil || IsNil(o.Storage) { + return nil, false + } + return o.Storage, true +} + +// HasStorage returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasStorage() bool { + if o != nil && !IsNil(o.Storage) { + return true + } + + return false +} + +// SetStorage gets a reference to the given Storage and assigns it to the Storage field. +func (o *DeviceCreateInput) SetStorage(v Storage) { + o.Storage = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *DeviceCreateInput) SetTags(v []string) { + o.Tags = v +} + +// GetTerminationTime returns the TerminationTime field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetTerminationTime() time.Time { + if o == nil || IsNil(o.TerminationTime) { + var ret time.Time + return ret + } + return *o.TerminationTime +} + +// GetTerminationTimeOk returns a tuple with the TerminationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetTerminationTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.TerminationTime) { + return nil, false + } + return o.TerminationTime, true +} + +// HasTerminationTime returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasTerminationTime() bool { + if o != nil && !IsNil(o.TerminationTime) { + return true + } + + return false +} + +// SetTerminationTime gets a reference to the given time.Time and assigns it to the TerminationTime field. +func (o *DeviceCreateInput) SetTerminationTime(v time.Time) { + o.TerminationTime = &v +} + +// GetUserSshKeys returns the UserSshKeys field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetUserSshKeys() []string { + if o == nil || IsNil(o.UserSshKeys) { + var ret []string + return ret + } + return o.UserSshKeys +} + +// GetUserSshKeysOk returns a tuple with the UserSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetUserSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.UserSshKeys) { + return nil, false + } + return o.UserSshKeys, true +} + +// HasUserSshKeys returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasUserSshKeys() bool { + if o != nil && !IsNil(o.UserSshKeys) { + return true + } + + return false +} + +// SetUserSshKeys gets a reference to the given []string and assigns it to the UserSshKeys field. +func (o *DeviceCreateInput) SetUserSshKeys(v []string) { + o.UserSshKeys = v +} + +// GetUserdata returns the Userdata field value if set, zero value otherwise. +func (o *DeviceCreateInput) GetUserdata() string { + if o == nil || IsNil(o.Userdata) { + var ret string + return ret + } + return *o.Userdata +} + +// GetUserdataOk returns a tuple with the Userdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreateInput) GetUserdataOk() (*string, bool) { + if o == nil || IsNil(o.Userdata) { + return nil, false + } + return o.Userdata, true +} + +// HasUserdata returns a boolean if a field has been set. +func (o *DeviceCreateInput) HasUserdata() bool { + if o != nil && !IsNil(o.Userdata) { + return true + } + + return false +} + +// SetUserdata gets a reference to the given string and assigns it to the Userdata field. +func (o *DeviceCreateInput) SetUserdata(v string) { + o.Userdata = &v +} + +func (o DeviceCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AlwaysPxe) { + toSerialize["always_pxe"] = o.AlwaysPxe + } + if !IsNil(o.BillingCycle) { + toSerialize["billing_cycle"] = o.BillingCycle + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Features) { + toSerialize["features"] = o.Features + } + if !IsNil(o.HardwareReservationId) { + toSerialize["hardware_reservation_id"] = o.HardwareReservationId + } + if !IsNil(o.Hostname) { + toSerialize["hostname"] = o.Hostname + } + if !IsNil(o.IpAddresses) { + toSerialize["ip_addresses"] = o.IpAddresses + } + if !IsNil(o.IpxeScriptUrl) { + toSerialize["ipxe_script_url"] = o.IpxeScriptUrl + } + if !IsNil(o.Locked) { + toSerialize["locked"] = o.Locked + } + if !IsNil(o.NetworkFrozen) { + toSerialize["network_frozen"] = o.NetworkFrozen + } + if !IsNil(o.NoSshKeys) { + toSerialize["no_ssh_keys"] = o.NoSshKeys + } + toSerialize["operating_system"] = o.OperatingSystem + toSerialize["plan"] = o.Plan + if !IsNil(o.PrivateIpv4SubnetSize) { + toSerialize["private_ipv4_subnet_size"] = o.PrivateIpv4SubnetSize + } + if !IsNil(o.ProjectSshKeys) { + toSerialize["project_ssh_keys"] = o.ProjectSshKeys + } + if !IsNil(o.PublicIpv4SubnetSize) { + toSerialize["public_ipv4_subnet_size"] = o.PublicIpv4SubnetSize + } + if !IsNil(o.SpotInstance) { + toSerialize["spot_instance"] = o.SpotInstance + } + if !IsNil(o.SpotPriceMax) { + toSerialize["spot_price_max"] = o.SpotPriceMax + } + if !IsNil(o.SshKeys) { + toSerialize["ssh_keys"] = o.SshKeys + } + if !IsNil(o.Storage) { + toSerialize["storage"] = o.Storage + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.TerminationTime) { + toSerialize["termination_time"] = o.TerminationTime + } + if !IsNil(o.UserSshKeys) { + toSerialize["user_ssh_keys"] = o.UserSshKeys + } + if !IsNil(o.Userdata) { + toSerialize["userdata"] = o.Userdata + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "operating_system", + "plan", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varDeviceCreateInput := _DeviceCreateInput{} + + err = json.Unmarshal(data, &varDeviceCreateInput) + + if err != nil { + return err + } + + *o = DeviceCreateInput(varDeviceCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "always_pxe") + delete(additionalProperties, "billing_cycle") + delete(additionalProperties, "customdata") + delete(additionalProperties, "description") + delete(additionalProperties, "features") + delete(additionalProperties, "hardware_reservation_id") + delete(additionalProperties, "hostname") + delete(additionalProperties, "ip_addresses") + delete(additionalProperties, "ipxe_script_url") + delete(additionalProperties, "locked") + delete(additionalProperties, "network_frozen") + delete(additionalProperties, "no_ssh_keys") + delete(additionalProperties, "operating_system") + delete(additionalProperties, "plan") + delete(additionalProperties, "private_ipv4_subnet_size") + delete(additionalProperties, "project_ssh_keys") + delete(additionalProperties, "public_ipv4_subnet_size") + delete(additionalProperties, "spot_instance") + delete(additionalProperties, "spot_price_max") + delete(additionalProperties, "ssh_keys") + delete(additionalProperties, "storage") + delete(additionalProperties, "tags") + delete(additionalProperties, "termination_time") + delete(additionalProperties, "user_ssh_keys") + delete(additionalProperties, "userdata") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceCreateInput struct { + value *DeviceCreateInput + isSet bool +} + +func (v NullableDeviceCreateInput) Get() *DeviceCreateInput { + return v.value +} + +func (v *NullableDeviceCreateInput) Set(val *DeviceCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceCreateInput(val *DeviceCreateInput) *NullableDeviceCreateInput { + return &NullableDeviceCreateInput{value: val, isSet: true} +} + +func (v NullableDeviceCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_input_billing_cycle.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_input_billing_cycle.go new file mode 100644 index 00000000..ae42ef76 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_create_input_billing_cycle.go @@ -0,0 +1,115 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// DeviceCreateInputBillingCycle The billing cycle of the device. +type DeviceCreateInputBillingCycle string + +// List of DeviceCreateInput_billing_cycle +const ( + DEVICECREATEINPUTBILLINGCYCLE_HOURLY DeviceCreateInputBillingCycle = "hourly" + DEVICECREATEINPUTBILLINGCYCLE_DAILY DeviceCreateInputBillingCycle = "daily" + DEVICECREATEINPUTBILLINGCYCLE_MONTHLY DeviceCreateInputBillingCycle = "monthly" + DEVICECREATEINPUTBILLINGCYCLE_YEARLY DeviceCreateInputBillingCycle = "yearly" +) + +// All allowed values of DeviceCreateInputBillingCycle enum +var AllowedDeviceCreateInputBillingCycleEnumValues = []DeviceCreateInputBillingCycle{ + "hourly", + "daily", + "monthly", + "yearly", +} + +func (v *DeviceCreateInputBillingCycle) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := DeviceCreateInputBillingCycle(value) + for _, existing := range AllowedDeviceCreateInputBillingCycleEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid DeviceCreateInputBillingCycle", value) +} + +// NewDeviceCreateInputBillingCycleFromValue returns a pointer to a valid DeviceCreateInputBillingCycle +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDeviceCreateInputBillingCycleFromValue(v string) (*DeviceCreateInputBillingCycle, error) { + ev := DeviceCreateInputBillingCycle(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DeviceCreateInputBillingCycle: valid values are %v", v, AllowedDeviceCreateInputBillingCycleEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DeviceCreateInputBillingCycle) IsValid() bool { + for _, existing := range AllowedDeviceCreateInputBillingCycleEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DeviceCreateInput_billing_cycle value +func (v DeviceCreateInputBillingCycle) Ptr() *DeviceCreateInputBillingCycle { + return &v +} + +type NullableDeviceCreateInputBillingCycle struct { + value *DeviceCreateInputBillingCycle + isSet bool +} + +func (v NullableDeviceCreateInputBillingCycle) Get() *DeviceCreateInputBillingCycle { + return v.value +} + +func (v *NullableDeviceCreateInputBillingCycle) Set(val *DeviceCreateInputBillingCycle) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceCreateInputBillingCycle) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceCreateInputBillingCycle) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceCreateInputBillingCycle(val *DeviceCreateInputBillingCycle) *NullableDeviceCreateInputBillingCycle { + return &NullableDeviceCreateInputBillingCycle{value: val, isSet: true} +} + +func (v NullableDeviceCreateInputBillingCycle) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceCreateInputBillingCycle) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_created_by.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_created_by.go new file mode 100644 index 00000000..58c5ff9d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_created_by.go @@ -0,0 +1,503 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the DeviceCreatedBy type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceCreatedBy{} + +// DeviceCreatedBy struct for DeviceCreatedBy +type DeviceCreatedBy struct { + // Avatar thumbnail URL of the User + AvatarThumbUrl *string `json:"avatar_thumb_url,omitempty"` + // When the user was created + CreatedAt *time.Time `json:"created_at,omitempty"` + // Primary email address of the User + Email *string `json:"email,omitempty"` + // First name of the User + FirstName *string `json:"first_name,omitempty"` + // Full name of the User + FullName *string `json:"full_name,omitempty"` + // API URL uniquely representing the User + Href *string `json:"href,omitempty"` + // ID of the User + Id string `json:"id"` + // Last name of the User + LastName *string `json:"last_name,omitempty"` + // Short ID of the User + ShortId string `json:"short_id"` + // When the user details were last updated + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceCreatedBy DeviceCreatedBy + +// NewDeviceCreatedBy instantiates a new DeviceCreatedBy object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceCreatedBy(id string, shortId string) *DeviceCreatedBy { + this := DeviceCreatedBy{} + this.Id = id + this.ShortId = shortId + return &this +} + +// NewDeviceCreatedByWithDefaults instantiates a new DeviceCreatedBy object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceCreatedByWithDefaults() *DeviceCreatedBy { + this := DeviceCreatedBy{} + return &this +} + +// GetAvatarThumbUrl returns the AvatarThumbUrl field value if set, zero value otherwise. +func (o *DeviceCreatedBy) GetAvatarThumbUrl() string { + if o == nil || IsNil(o.AvatarThumbUrl) { + var ret string + return ret + } + return *o.AvatarThumbUrl +} + +// GetAvatarThumbUrlOk returns a tuple with the AvatarThumbUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreatedBy) GetAvatarThumbUrlOk() (*string, bool) { + if o == nil || IsNil(o.AvatarThumbUrl) { + return nil, false + } + return o.AvatarThumbUrl, true +} + +// HasAvatarThumbUrl returns a boolean if a field has been set. +func (o *DeviceCreatedBy) HasAvatarThumbUrl() bool { + if o != nil && !IsNil(o.AvatarThumbUrl) { + return true + } + + return false +} + +// SetAvatarThumbUrl gets a reference to the given string and assigns it to the AvatarThumbUrl field. +func (o *DeviceCreatedBy) SetAvatarThumbUrl(v string) { + o.AvatarThumbUrl = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *DeviceCreatedBy) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreatedBy) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *DeviceCreatedBy) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *DeviceCreatedBy) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *DeviceCreatedBy) GetEmail() string { + if o == nil || IsNil(o.Email) { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreatedBy) GetEmailOk() (*string, bool) { + if o == nil || IsNil(o.Email) { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *DeviceCreatedBy) HasEmail() bool { + if o != nil && !IsNil(o.Email) { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *DeviceCreatedBy) SetEmail(v string) { + o.Email = &v +} + +// GetFirstName returns the FirstName field value if set, zero value otherwise. +func (o *DeviceCreatedBy) GetFirstName() string { + if o == nil || IsNil(o.FirstName) { + var ret string + return ret + } + return *o.FirstName +} + +// GetFirstNameOk returns a tuple with the FirstName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreatedBy) GetFirstNameOk() (*string, bool) { + if o == nil || IsNil(o.FirstName) { + return nil, false + } + return o.FirstName, true +} + +// HasFirstName returns a boolean if a field has been set. +func (o *DeviceCreatedBy) HasFirstName() bool { + if o != nil && !IsNil(o.FirstName) { + return true + } + + return false +} + +// SetFirstName gets a reference to the given string and assigns it to the FirstName field. +func (o *DeviceCreatedBy) SetFirstName(v string) { + o.FirstName = &v +} + +// GetFullName returns the FullName field value if set, zero value otherwise. +func (o *DeviceCreatedBy) GetFullName() string { + if o == nil || IsNil(o.FullName) { + var ret string + return ret + } + return *o.FullName +} + +// GetFullNameOk returns a tuple with the FullName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreatedBy) GetFullNameOk() (*string, bool) { + if o == nil || IsNil(o.FullName) { + return nil, false + } + return o.FullName, true +} + +// HasFullName returns a boolean if a field has been set. +func (o *DeviceCreatedBy) HasFullName() bool { + if o != nil && !IsNil(o.FullName) { + return true + } + + return false +} + +// SetFullName gets a reference to the given string and assigns it to the FullName field. +func (o *DeviceCreatedBy) SetFullName(v string) { + o.FullName = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *DeviceCreatedBy) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreatedBy) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *DeviceCreatedBy) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *DeviceCreatedBy) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value +func (o *DeviceCreatedBy) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *DeviceCreatedBy) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *DeviceCreatedBy) SetId(v string) { + o.Id = v +} + +// GetLastName returns the LastName field value if set, zero value otherwise. +func (o *DeviceCreatedBy) GetLastName() string { + if o == nil || IsNil(o.LastName) { + var ret string + return ret + } + return *o.LastName +} + +// GetLastNameOk returns a tuple with the LastName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreatedBy) GetLastNameOk() (*string, bool) { + if o == nil || IsNil(o.LastName) { + return nil, false + } + return o.LastName, true +} + +// HasLastName returns a boolean if a field has been set. +func (o *DeviceCreatedBy) HasLastName() bool { + if o != nil && !IsNil(o.LastName) { + return true + } + + return false +} + +// SetLastName gets a reference to the given string and assigns it to the LastName field. +func (o *DeviceCreatedBy) SetLastName(v string) { + o.LastName = &v +} + +// GetShortId returns the ShortId field value +func (o *DeviceCreatedBy) GetShortId() string { + if o == nil { + var ret string + return ret + } + + return o.ShortId +} + +// GetShortIdOk returns a tuple with the ShortId field value +// and a boolean to check if the value has been set. +func (o *DeviceCreatedBy) GetShortIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShortId, true +} + +// SetShortId sets field value +func (o *DeviceCreatedBy) SetShortId(v string) { + o.ShortId = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *DeviceCreatedBy) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceCreatedBy) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *DeviceCreatedBy) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *DeviceCreatedBy) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o DeviceCreatedBy) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceCreatedBy) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AvatarThumbUrl) { + toSerialize["avatar_thumb_url"] = o.AvatarThumbUrl + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Email) { + toSerialize["email"] = o.Email + } + if !IsNil(o.FirstName) { + toSerialize["first_name"] = o.FirstName + } + if !IsNil(o.FullName) { + toSerialize["full_name"] = o.FullName + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + toSerialize["id"] = o.Id + if !IsNil(o.LastName) { + toSerialize["last_name"] = o.LastName + } + toSerialize["short_id"] = o.ShortId + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceCreatedBy) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "short_id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varDeviceCreatedBy := _DeviceCreatedBy{} + + err = json.Unmarshal(data, &varDeviceCreatedBy) + + if err != nil { + return err + } + + *o = DeviceCreatedBy(varDeviceCreatedBy) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "avatar_thumb_url") + delete(additionalProperties, "created_at") + delete(additionalProperties, "email") + delete(additionalProperties, "first_name") + delete(additionalProperties, "full_name") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "last_name") + delete(additionalProperties, "short_id") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceCreatedBy struct { + value *DeviceCreatedBy + isSet bool +} + +func (v NullableDeviceCreatedBy) Get() *DeviceCreatedBy { + return v.value +} + +func (v *NullableDeviceCreatedBy) Set(val *DeviceCreatedBy) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceCreatedBy) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceCreatedBy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceCreatedBy(val *DeviceCreatedBy) *NullableDeviceCreatedBy { + return &NullableDeviceCreatedBy{value: val, isSet: true} +} + +func (v NullableDeviceCreatedBy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceCreatedBy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_health_rollup.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_health_rollup.go new file mode 100644 index 00000000..839f8e63 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_health_rollup.go @@ -0,0 +1,193 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the DeviceHealthRollup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceHealthRollup{} + +// DeviceHealthRollup Represents a Device Health Status +type DeviceHealthRollup struct { + HealthRollup *DeviceHealthRollupHealthRollup `json:"health_rollup,omitempty"` + // Last update of health status. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceHealthRollup DeviceHealthRollup + +// NewDeviceHealthRollup instantiates a new DeviceHealthRollup object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceHealthRollup() *DeviceHealthRollup { + this := DeviceHealthRollup{} + return &this +} + +// NewDeviceHealthRollupWithDefaults instantiates a new DeviceHealthRollup object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceHealthRollupWithDefaults() *DeviceHealthRollup { + this := DeviceHealthRollup{} + return &this +} + +// GetHealthRollup returns the HealthRollup field value if set, zero value otherwise. +func (o *DeviceHealthRollup) GetHealthRollup() DeviceHealthRollupHealthRollup { + if o == nil || IsNil(o.HealthRollup) { + var ret DeviceHealthRollupHealthRollup + return ret + } + return *o.HealthRollup +} + +// GetHealthRollupOk returns a tuple with the HealthRollup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceHealthRollup) GetHealthRollupOk() (*DeviceHealthRollupHealthRollup, bool) { + if o == nil || IsNil(o.HealthRollup) { + return nil, false + } + return o.HealthRollup, true +} + +// HasHealthRollup returns a boolean if a field has been set. +func (o *DeviceHealthRollup) HasHealthRollup() bool { + if o != nil && !IsNil(o.HealthRollup) { + return true + } + + return false +} + +// SetHealthRollup gets a reference to the given DeviceHealthRollupHealthRollup and assigns it to the HealthRollup field. +func (o *DeviceHealthRollup) SetHealthRollup(v DeviceHealthRollupHealthRollup) { + o.HealthRollup = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *DeviceHealthRollup) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceHealthRollup) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *DeviceHealthRollup) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *DeviceHealthRollup) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o DeviceHealthRollup) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceHealthRollup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.HealthRollup) { + toSerialize["health_rollup"] = o.HealthRollup + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceHealthRollup) UnmarshalJSON(data []byte) (err error) { + varDeviceHealthRollup := _DeviceHealthRollup{} + + err = json.Unmarshal(data, &varDeviceHealthRollup) + + if err != nil { + return err + } + + *o = DeviceHealthRollup(varDeviceHealthRollup) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "health_rollup") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceHealthRollup struct { + value *DeviceHealthRollup + isSet bool +} + +func (v NullableDeviceHealthRollup) Get() *DeviceHealthRollup { + return v.value +} + +func (v *NullableDeviceHealthRollup) Set(val *DeviceHealthRollup) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceHealthRollup) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceHealthRollup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceHealthRollup(val *DeviceHealthRollup) *NullableDeviceHealthRollup { + return &NullableDeviceHealthRollup{value: val, isSet: true} +} + +func (v NullableDeviceHealthRollup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceHealthRollup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_health_rollup_health_rollup.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_health_rollup_health_rollup.go new file mode 100644 index 00000000..36569030 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_health_rollup_health_rollup.go @@ -0,0 +1,113 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// DeviceHealthRollupHealthRollup Health Status +type DeviceHealthRollupHealthRollup string + +// List of DeviceHealthRollup_health_rollup +const ( + DEVICEHEALTHROLLUPHEALTHROLLUP_OK DeviceHealthRollupHealthRollup = "ok" + DEVICEHEALTHROLLUPHEALTHROLLUP_WARNING DeviceHealthRollupHealthRollup = "warning" + DEVICEHEALTHROLLUPHEALTHROLLUP_CRITICAL DeviceHealthRollupHealthRollup = "critical" +) + +// All allowed values of DeviceHealthRollupHealthRollup enum +var AllowedDeviceHealthRollupHealthRollupEnumValues = []DeviceHealthRollupHealthRollup{ + "ok", + "warning", + "critical", +} + +func (v *DeviceHealthRollupHealthRollup) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := DeviceHealthRollupHealthRollup(value) + for _, existing := range AllowedDeviceHealthRollupHealthRollupEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid DeviceHealthRollupHealthRollup", value) +} + +// NewDeviceHealthRollupHealthRollupFromValue returns a pointer to a valid DeviceHealthRollupHealthRollup +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDeviceHealthRollupHealthRollupFromValue(v string) (*DeviceHealthRollupHealthRollup, error) { + ev := DeviceHealthRollupHealthRollup(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DeviceHealthRollupHealthRollup: valid values are %v", v, AllowedDeviceHealthRollupHealthRollupEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DeviceHealthRollupHealthRollup) IsValid() bool { + for _, existing := range AllowedDeviceHealthRollupHealthRollupEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DeviceHealthRollup_health_rollup value +func (v DeviceHealthRollupHealthRollup) Ptr() *DeviceHealthRollupHealthRollup { + return &v +} + +type NullableDeviceHealthRollupHealthRollup struct { + value *DeviceHealthRollupHealthRollup + isSet bool +} + +func (v NullableDeviceHealthRollupHealthRollup) Get() *DeviceHealthRollupHealthRollup { + return v.value +} + +func (v *NullableDeviceHealthRollupHealthRollup) Set(val *DeviceHealthRollupHealthRollup) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceHealthRollupHealthRollup) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceHealthRollupHealthRollup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceHealthRollupHealthRollup(val *DeviceHealthRollupHealthRollup) *NullableDeviceHealthRollupHealthRollup { + return &NullableDeviceHealthRollupHealthRollup{value: val, isSet: true} +} + +func (v NullableDeviceHealthRollupHealthRollup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceHealthRollupHealthRollup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_list.go new file mode 100644 index 00000000..e3b21cf4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_list.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the DeviceList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceList{} + +// DeviceList struct for DeviceList +type DeviceList struct { + Devices []Device `json:"devices,omitempty"` + Meta *Meta `json:"meta,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceList DeviceList + +// NewDeviceList instantiates a new DeviceList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceList() *DeviceList { + this := DeviceList{} + return &this +} + +// NewDeviceListWithDefaults instantiates a new DeviceList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceListWithDefaults() *DeviceList { + this := DeviceList{} + return &this +} + +// GetDevices returns the Devices field value if set, zero value otherwise. +func (o *DeviceList) GetDevices() []Device { + if o == nil || IsNil(o.Devices) { + var ret []Device + return ret + } + return o.Devices +} + +// GetDevicesOk returns a tuple with the Devices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceList) GetDevicesOk() ([]Device, bool) { + if o == nil || IsNil(o.Devices) { + return nil, false + } + return o.Devices, true +} + +// HasDevices returns a boolean if a field has been set. +func (o *DeviceList) HasDevices() bool { + if o != nil && !IsNil(o.Devices) { + return true + } + + return false +} + +// SetDevices gets a reference to the given []Device and assigns it to the Devices field. +func (o *DeviceList) SetDevices(v []Device) { + o.Devices = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *DeviceList) GetMeta() Meta { + if o == nil || IsNil(o.Meta) { + var ret Meta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceList) GetMetaOk() (*Meta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *DeviceList) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given Meta and assigns it to the Meta field. +func (o *DeviceList) SetMeta(v Meta) { + o.Meta = &v +} + +func (o DeviceList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Devices) { + toSerialize["devices"] = o.Devices + } + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceList) UnmarshalJSON(data []byte) (err error) { + varDeviceList := _DeviceList{} + + err = json.Unmarshal(data, &varDeviceList) + + if err != nil { + return err + } + + *o = DeviceList(varDeviceList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "devices") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceList struct { + value *DeviceList + isSet bool +} + +func (v NullableDeviceList) Get() *DeviceList { + return v.value +} + +func (v *NullableDeviceList) Set(val *DeviceList) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceList) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceList(val *DeviceList) *NullableDeviceList { + return &NullableDeviceList{value: val, isSet: true} +} + +func (v NullableDeviceList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_metro.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_metro.go new file mode 100644 index 00000000..33924c96 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_metro.go @@ -0,0 +1,265 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the DeviceMetro type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceMetro{} + +// DeviceMetro struct for DeviceMetro +type DeviceMetro struct { + Code *string `json:"code,omitempty"` + Country *string `json:"country,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceMetro DeviceMetro + +// NewDeviceMetro instantiates a new DeviceMetro object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceMetro() *DeviceMetro { + this := DeviceMetro{} + return &this +} + +// NewDeviceMetroWithDefaults instantiates a new DeviceMetro object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceMetroWithDefaults() *DeviceMetro { + this := DeviceMetro{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *DeviceMetro) GetCode() string { + if o == nil || IsNil(o.Code) { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceMetro) GetCodeOk() (*string, bool) { + if o == nil || IsNil(o.Code) { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *DeviceMetro) HasCode() bool { + if o != nil && !IsNil(o.Code) { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *DeviceMetro) SetCode(v string) { + o.Code = &v +} + +// GetCountry returns the Country field value if set, zero value otherwise. +func (o *DeviceMetro) GetCountry() string { + if o == nil || IsNil(o.Country) { + var ret string + return ret + } + return *o.Country +} + +// GetCountryOk returns a tuple with the Country field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceMetro) GetCountryOk() (*string, bool) { + if o == nil || IsNil(o.Country) { + return nil, false + } + return o.Country, true +} + +// HasCountry returns a boolean if a field has been set. +func (o *DeviceMetro) HasCountry() bool { + if o != nil && !IsNil(o.Country) { + return true + } + + return false +} + +// SetCountry gets a reference to the given string and assigns it to the Country field. +func (o *DeviceMetro) SetCountry(v string) { + o.Country = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DeviceMetro) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceMetro) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *DeviceMetro) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *DeviceMetro) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DeviceMetro) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceMetro) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *DeviceMetro) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DeviceMetro) SetName(v string) { + o.Name = &v +} + +func (o DeviceMetro) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceMetro) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Code) { + toSerialize["code"] = o.Code + } + if !IsNil(o.Country) { + toSerialize["country"] = o.Country + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceMetro) UnmarshalJSON(data []byte) (err error) { + varDeviceMetro := _DeviceMetro{} + + err = json.Unmarshal(data, &varDeviceMetro) + + if err != nil { + return err + } + + *o = DeviceMetro(varDeviceMetro) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "country") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceMetro struct { + value *DeviceMetro + isSet bool +} + +func (v NullableDeviceMetro) Get() *DeviceMetro { + return v.value +} + +func (v *NullableDeviceMetro) Set(val *DeviceMetro) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceMetro) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceMetro) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceMetro(val *DeviceMetro) *NullableDeviceMetro { + return &NullableDeviceMetro{value: val, isSet: true} +} + +func (v NullableDeviceMetro) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceMetro) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_project_lite.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_project_lite.go new file mode 100644 index 00000000..07150cf2 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_project_lite.go @@ -0,0 +1,167 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the DeviceProjectLite type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceProjectLite{} + +// DeviceProjectLite struct for DeviceProjectLite +type DeviceProjectLite struct { + Href string `json:"href"` + AdditionalProperties map[string]interface{} +} + +type _DeviceProjectLite DeviceProjectLite + +// NewDeviceProjectLite instantiates a new DeviceProjectLite object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceProjectLite(href string) *DeviceProjectLite { + this := DeviceProjectLite{} + this.Href = href + return &this +} + +// NewDeviceProjectLiteWithDefaults instantiates a new DeviceProjectLite object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceProjectLiteWithDefaults() *DeviceProjectLite { + this := DeviceProjectLite{} + return &this +} + +// GetHref returns the Href field value +func (o *DeviceProjectLite) GetHref() string { + if o == nil { + var ret string + return ret + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +func (o *DeviceProjectLite) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Href, true +} + +// SetHref sets field value +func (o *DeviceProjectLite) SetHref(v string) { + o.Href = v +} + +func (o DeviceProjectLite) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceProjectLite) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["href"] = o.Href + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceProjectLite) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "href", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varDeviceProjectLite := _DeviceProjectLite{} + + err = json.Unmarshal(data, &varDeviceProjectLite) + + if err != nil { + return err + } + + *o = DeviceProjectLite(varDeviceProjectLite) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "href") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceProjectLite struct { + value *DeviceProjectLite + isSet bool +} + +func (v NullableDeviceProjectLite) Get() *DeviceProjectLite { + return v.value +} + +func (v *NullableDeviceProjectLite) Set(val *DeviceProjectLite) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceProjectLite) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceProjectLite) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceProjectLite(val *DeviceProjectLite) *NullableDeviceProjectLite { + return &NullableDeviceProjectLite{value: val, isSet: true} +} + +func (v NullableDeviceProjectLite) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceProjectLite) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_state.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_state.go new file mode 100644 index 00000000..4184a792 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_state.go @@ -0,0 +1,127 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// DeviceState The current state the instance is in. * When an instance is initially created it will be in the `queued` state until it is picked up by the provisioner. * Once provisioning has begun on the instance it's state will move to `provisioning`. * When an instance is deleted, it will move to `deprovisioning` state until the deprovision is completed and the instance state moves to `deleted`. * If an instance fails to provision or deprovision it will move to `failed` state. * Once an instance has completed provisioning it will move to `active` state. * If an instance is currently powering off or powering on it will move to `powering_off` or `powering_on` states respectively. * When the instance is powered off completely it will move to the `inactive` state. * When an instance is powered on completely it will move to the `active` state. * Using the reinstall action to install a new OS on the instance will cause the instance state to change to `reinstalling`. * When the reinstall action is complete the instance will move to `active` state. +type DeviceState string + +// List of Device_state +const ( + DEVICESTATE_QUEUED DeviceState = "queued" + DEVICESTATE_PROVISIONING DeviceState = "provisioning" + DEVICESTATE_DEPROVISIONING DeviceState = "deprovisioning" + DEVICESTATE_REINSTALLING DeviceState = "reinstalling" + DEVICESTATE_ACTIVE DeviceState = "active" + DEVICESTATE_INACTIVE DeviceState = "inactive" + DEVICESTATE_FAILED DeviceState = "failed" + DEVICESTATE_POWERING_ON DeviceState = "powering_on" + DEVICESTATE_POWERING_OFF DeviceState = "powering_off" + DEVICESTATE_DELETED DeviceState = "deleted" +) + +// All allowed values of DeviceState enum +var AllowedDeviceStateEnumValues = []DeviceState{ + "queued", + "provisioning", + "deprovisioning", + "reinstalling", + "active", + "inactive", + "failed", + "powering_on", + "powering_off", + "deleted", +} + +func (v *DeviceState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := DeviceState(value) + for _, existing := range AllowedDeviceStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid DeviceState", value) +} + +// NewDeviceStateFromValue returns a pointer to a valid DeviceState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDeviceStateFromValue(v string) (*DeviceState, error) { + ev := DeviceState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DeviceState: valid values are %v", v, AllowedDeviceStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DeviceState) IsValid() bool { + for _, existing := range AllowedDeviceStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Device_state value +func (v DeviceState) Ptr() *DeviceState { + return &v +} + +type NullableDeviceState struct { + value *DeviceState + isSet bool +} + +func (v NullableDeviceState) Get() *DeviceState { + return v.value +} + +func (v *NullableDeviceState) Set(val *DeviceState) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceState) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceState(val *DeviceState) *NullableDeviceState { + return &NullableDeviceState{value: val, isSet: true} +} + +func (v NullableDeviceState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_update_input.go new file mode 100644 index 00000000..6a854943 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_update_input.go @@ -0,0 +1,564 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the DeviceUpdateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceUpdateInput{} + +// DeviceUpdateInput struct for DeviceUpdateInput +type DeviceUpdateInput struct { + AlwaysPxe *bool `json:"always_pxe,omitempty"` + BillingCycle *string `json:"billing_cycle,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Description *string `json:"description,omitempty"` + Hostname *string `json:"hostname,omitempty"` + FirmwareSetId *string `json:"firmware_set_id,omitempty"` + IpxeScriptUrl *string `json:"ipxe_script_url,omitempty"` + // Whether the device should be locked, preventing accidental deletion. + Locked *bool `json:"locked,omitempty"` + // If true, this instance can not be converted to a different network type. + NetworkFrozen *bool `json:"network_frozen,omitempty"` + // Can be set to false to convert a spot-market instance to on-demand. + SpotInstance *bool `json:"spot_instance,omitempty"` + Tags []string `json:"tags,omitempty"` + Userdata *string `json:"userdata,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceUpdateInput DeviceUpdateInput + +// NewDeviceUpdateInput instantiates a new DeviceUpdateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceUpdateInput() *DeviceUpdateInput { + this := DeviceUpdateInput{} + return &this +} + +// NewDeviceUpdateInputWithDefaults instantiates a new DeviceUpdateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceUpdateInputWithDefaults() *DeviceUpdateInput { + this := DeviceUpdateInput{} + return &this +} + +// GetAlwaysPxe returns the AlwaysPxe field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetAlwaysPxe() bool { + if o == nil || IsNil(o.AlwaysPxe) { + var ret bool + return ret + } + return *o.AlwaysPxe +} + +// GetAlwaysPxeOk returns a tuple with the AlwaysPxe field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetAlwaysPxeOk() (*bool, bool) { + if o == nil || IsNil(o.AlwaysPxe) { + return nil, false + } + return o.AlwaysPxe, true +} + +// HasAlwaysPxe returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasAlwaysPxe() bool { + if o != nil && !IsNil(o.AlwaysPxe) { + return true + } + + return false +} + +// SetAlwaysPxe gets a reference to the given bool and assigns it to the AlwaysPxe field. +func (o *DeviceUpdateInput) SetAlwaysPxe(v bool) { + o.AlwaysPxe = &v +} + +// GetBillingCycle returns the BillingCycle field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetBillingCycle() string { + if o == nil || IsNil(o.BillingCycle) { + var ret string + return ret + } + return *o.BillingCycle +} + +// GetBillingCycleOk returns a tuple with the BillingCycle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetBillingCycleOk() (*string, bool) { + if o == nil || IsNil(o.BillingCycle) { + return nil, false + } + return o.BillingCycle, true +} + +// HasBillingCycle returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasBillingCycle() bool { + if o != nil && !IsNil(o.BillingCycle) { + return true + } + + return false +} + +// SetBillingCycle gets a reference to the given string and assigns it to the BillingCycle field. +func (o *DeviceUpdateInput) SetBillingCycle(v string) { + o.BillingCycle = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *DeviceUpdateInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *DeviceUpdateInput) SetDescription(v string) { + o.Description = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetHostname() string { + if o == nil || IsNil(o.Hostname) { + var ret string + return ret + } + return *o.Hostname +} + +// GetHostnameOk returns a tuple with the Hostname field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetHostnameOk() (*string, bool) { + if o == nil || IsNil(o.Hostname) { + return nil, false + } + return o.Hostname, true +} + +// HasHostname returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasHostname() bool { + if o != nil && !IsNil(o.Hostname) { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *DeviceUpdateInput) SetHostname(v string) { + o.Hostname = &v +} + +// GetFirmwareSetId returns the FirmwareSetId field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetFirmwareSetId() string { + if o == nil || IsNil(o.FirmwareSetId) { + var ret string + return ret + } + return *o.FirmwareSetId +} + +// GetFirmwareSetIdOk returns a tuple with the FirmwareSetId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetFirmwareSetIdOk() (*string, bool) { + if o == nil || IsNil(o.FirmwareSetId) { + return nil, false + } + return o.FirmwareSetId, true +} + +// HasFirmwareSetId returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasFirmwareSetId() bool { + if o != nil && !IsNil(o.FirmwareSetId) { + return true + } + + return false +} + +// SetFirmwareSetId gets a reference to the given string and assigns it to the FirmwareSetId field. +func (o *DeviceUpdateInput) SetFirmwareSetId(v string) { + o.FirmwareSetId = &v +} + +// GetIpxeScriptUrl returns the IpxeScriptUrl field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetIpxeScriptUrl() string { + if o == nil || IsNil(o.IpxeScriptUrl) { + var ret string + return ret + } + return *o.IpxeScriptUrl +} + +// GetIpxeScriptUrlOk returns a tuple with the IpxeScriptUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetIpxeScriptUrlOk() (*string, bool) { + if o == nil || IsNil(o.IpxeScriptUrl) { + return nil, false + } + return o.IpxeScriptUrl, true +} + +// HasIpxeScriptUrl returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasIpxeScriptUrl() bool { + if o != nil && !IsNil(o.IpxeScriptUrl) { + return true + } + + return false +} + +// SetIpxeScriptUrl gets a reference to the given string and assigns it to the IpxeScriptUrl field. +func (o *DeviceUpdateInput) SetIpxeScriptUrl(v string) { + o.IpxeScriptUrl = &v +} + +// GetLocked returns the Locked field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetLocked() bool { + if o == nil || IsNil(o.Locked) { + var ret bool + return ret + } + return *o.Locked +} + +// GetLockedOk returns a tuple with the Locked field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetLockedOk() (*bool, bool) { + if o == nil || IsNil(o.Locked) { + return nil, false + } + return o.Locked, true +} + +// HasLocked returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasLocked() bool { + if o != nil && !IsNil(o.Locked) { + return true + } + + return false +} + +// SetLocked gets a reference to the given bool and assigns it to the Locked field. +func (o *DeviceUpdateInput) SetLocked(v bool) { + o.Locked = &v +} + +// GetNetworkFrozen returns the NetworkFrozen field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetNetworkFrozen() bool { + if o == nil || IsNil(o.NetworkFrozen) { + var ret bool + return ret + } + return *o.NetworkFrozen +} + +// GetNetworkFrozenOk returns a tuple with the NetworkFrozen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetNetworkFrozenOk() (*bool, bool) { + if o == nil || IsNil(o.NetworkFrozen) { + return nil, false + } + return o.NetworkFrozen, true +} + +// HasNetworkFrozen returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasNetworkFrozen() bool { + if o != nil && !IsNil(o.NetworkFrozen) { + return true + } + + return false +} + +// SetNetworkFrozen gets a reference to the given bool and assigns it to the NetworkFrozen field. +func (o *DeviceUpdateInput) SetNetworkFrozen(v bool) { + o.NetworkFrozen = &v +} + +// GetSpotInstance returns the SpotInstance field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetSpotInstance() bool { + if o == nil || IsNil(o.SpotInstance) { + var ret bool + return ret + } + return *o.SpotInstance +} + +// GetSpotInstanceOk returns a tuple with the SpotInstance field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetSpotInstanceOk() (*bool, bool) { + if o == nil || IsNil(o.SpotInstance) { + return nil, false + } + return o.SpotInstance, true +} + +// HasSpotInstance returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasSpotInstance() bool { + if o != nil && !IsNil(o.SpotInstance) { + return true + } + + return false +} + +// SetSpotInstance gets a reference to the given bool and assigns it to the SpotInstance field. +func (o *DeviceUpdateInput) SetSpotInstance(v bool) { + o.SpotInstance = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *DeviceUpdateInput) SetTags(v []string) { + o.Tags = v +} + +// GetUserdata returns the Userdata field value if set, zero value otherwise. +func (o *DeviceUpdateInput) GetUserdata() string { + if o == nil || IsNil(o.Userdata) { + var ret string + return ret + } + return *o.Userdata +} + +// GetUserdataOk returns a tuple with the Userdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUpdateInput) GetUserdataOk() (*string, bool) { + if o == nil || IsNil(o.Userdata) { + return nil, false + } + return o.Userdata, true +} + +// HasUserdata returns a boolean if a field has been set. +func (o *DeviceUpdateInput) HasUserdata() bool { + if o != nil && !IsNil(o.Userdata) { + return true + } + + return false +} + +// SetUserdata gets a reference to the given string and assigns it to the Userdata field. +func (o *DeviceUpdateInput) SetUserdata(v string) { + o.Userdata = &v +} + +func (o DeviceUpdateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceUpdateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AlwaysPxe) { + toSerialize["always_pxe"] = o.AlwaysPxe + } + if !IsNil(o.BillingCycle) { + toSerialize["billing_cycle"] = o.BillingCycle + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Hostname) { + toSerialize["hostname"] = o.Hostname + } + if !IsNil(o.FirmwareSetId) { + toSerialize["firmware_set_id"] = o.FirmwareSetId + } + if !IsNil(o.IpxeScriptUrl) { + toSerialize["ipxe_script_url"] = o.IpxeScriptUrl + } + if !IsNil(o.Locked) { + toSerialize["locked"] = o.Locked + } + if !IsNil(o.NetworkFrozen) { + toSerialize["network_frozen"] = o.NetworkFrozen + } + if !IsNil(o.SpotInstance) { + toSerialize["spot_instance"] = o.SpotInstance + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Userdata) { + toSerialize["userdata"] = o.Userdata + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceUpdateInput) UnmarshalJSON(data []byte) (err error) { + varDeviceUpdateInput := _DeviceUpdateInput{} + + err = json.Unmarshal(data, &varDeviceUpdateInput) + + if err != nil { + return err + } + + *o = DeviceUpdateInput(varDeviceUpdateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "always_pxe") + delete(additionalProperties, "billing_cycle") + delete(additionalProperties, "customdata") + delete(additionalProperties, "description") + delete(additionalProperties, "hostname") + delete(additionalProperties, "firmware_set_id") + delete(additionalProperties, "ipxe_script_url") + delete(additionalProperties, "locked") + delete(additionalProperties, "network_frozen") + delete(additionalProperties, "spot_instance") + delete(additionalProperties, "tags") + delete(additionalProperties, "userdata") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceUpdateInput struct { + value *DeviceUpdateInput + isSet bool +} + +func (v NullableDeviceUpdateInput) Get() *DeviceUpdateInput { + return v.value +} + +func (v *NullableDeviceUpdateInput) Set(val *DeviceUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceUpdateInput(val *DeviceUpdateInput) *NullableDeviceUpdateInput { + return &NullableDeviceUpdateInput{value: val, isSet: true} +} + +func (v NullableDeviceUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_usage.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_usage.go new file mode 100644 index 00000000..f772b726 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_usage.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the DeviceUsage type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceUsage{} + +// DeviceUsage struct for DeviceUsage +type DeviceUsage struct { + Quantity *string `json:"quantity,omitempty"` + Total *string `json:"total,omitempty"` + Unit *string `json:"unit,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceUsage DeviceUsage + +// NewDeviceUsage instantiates a new DeviceUsage object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceUsage() *DeviceUsage { + this := DeviceUsage{} + return &this +} + +// NewDeviceUsageWithDefaults instantiates a new DeviceUsage object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceUsageWithDefaults() *DeviceUsage { + this := DeviceUsage{} + return &this +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *DeviceUsage) GetQuantity() string { + if o == nil || IsNil(o.Quantity) { + var ret string + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUsage) GetQuantityOk() (*string, bool) { + if o == nil || IsNil(o.Quantity) { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *DeviceUsage) HasQuantity() bool { + if o != nil && !IsNil(o.Quantity) { + return true + } + + return false +} + +// SetQuantity gets a reference to the given string and assigns it to the Quantity field. +func (o *DeviceUsage) SetQuantity(v string) { + o.Quantity = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *DeviceUsage) GetTotal() string { + if o == nil || IsNil(o.Total) { + var ret string + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUsage) GetTotalOk() (*string, bool) { + if o == nil || IsNil(o.Total) { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *DeviceUsage) HasTotal() bool { + if o != nil && !IsNil(o.Total) { + return true + } + + return false +} + +// SetTotal gets a reference to the given string and assigns it to the Total field. +func (o *DeviceUsage) SetTotal(v string) { + o.Total = &v +} + +// GetUnit returns the Unit field value if set, zero value otherwise. +func (o *DeviceUsage) GetUnit() string { + if o == nil || IsNil(o.Unit) { + var ret string + return ret + } + return *o.Unit +} + +// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUsage) GetUnitOk() (*string, bool) { + if o == nil || IsNil(o.Unit) { + return nil, false + } + return o.Unit, true +} + +// HasUnit returns a boolean if a field has been set. +func (o *DeviceUsage) HasUnit() bool { + if o != nil && !IsNil(o.Unit) { + return true + } + + return false +} + +// SetUnit gets a reference to the given string and assigns it to the Unit field. +func (o *DeviceUsage) SetUnit(v string) { + o.Unit = &v +} + +func (o DeviceUsage) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceUsage) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Quantity) { + toSerialize["quantity"] = o.Quantity + } + if !IsNil(o.Total) { + toSerialize["total"] = o.Total + } + if !IsNil(o.Unit) { + toSerialize["unit"] = o.Unit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceUsage) UnmarshalJSON(data []byte) (err error) { + varDeviceUsage := _DeviceUsage{} + + err = json.Unmarshal(data, &varDeviceUsage) + + if err != nil { + return err + } + + *o = DeviceUsage(varDeviceUsage) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "quantity") + delete(additionalProperties, "total") + delete(additionalProperties, "unit") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceUsage struct { + value *DeviceUsage + isSet bool +} + +func (v NullableDeviceUsage) Get() *DeviceUsage { + return v.value +} + +func (v *NullableDeviceUsage) Set(val *DeviceUsage) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceUsage) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceUsage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceUsage(val *DeviceUsage) *NullableDeviceUsage { + return &NullableDeviceUsage{value: val, isSet: true} +} + +func (v NullableDeviceUsage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceUsage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_usage_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_usage_list.go new file mode 100644 index 00000000..ae97e4c9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_device_usage_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the DeviceUsageList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeviceUsageList{} + +// DeviceUsageList struct for DeviceUsageList +type DeviceUsageList struct { + Usages []DeviceUsage `json:"usages,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeviceUsageList DeviceUsageList + +// NewDeviceUsageList instantiates a new DeviceUsageList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeviceUsageList() *DeviceUsageList { + this := DeviceUsageList{} + return &this +} + +// NewDeviceUsageListWithDefaults instantiates a new DeviceUsageList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeviceUsageListWithDefaults() *DeviceUsageList { + this := DeviceUsageList{} + return &this +} + +// GetUsages returns the Usages field value if set, zero value otherwise. +func (o *DeviceUsageList) GetUsages() []DeviceUsage { + if o == nil || IsNil(o.Usages) { + var ret []DeviceUsage + return ret + } + return o.Usages +} + +// GetUsagesOk returns a tuple with the Usages field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeviceUsageList) GetUsagesOk() ([]DeviceUsage, bool) { + if o == nil || IsNil(o.Usages) { + return nil, false + } + return o.Usages, true +} + +// HasUsages returns a boolean if a field has been set. +func (o *DeviceUsageList) HasUsages() bool { + if o != nil && !IsNil(o.Usages) { + return true + } + + return false +} + +// SetUsages gets a reference to the given []DeviceUsage and assigns it to the Usages field. +func (o *DeviceUsageList) SetUsages(v []DeviceUsage) { + o.Usages = v +} + +func (o DeviceUsageList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeviceUsageList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Usages) { + toSerialize["usages"] = o.Usages + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeviceUsageList) UnmarshalJSON(data []byte) (err error) { + varDeviceUsageList := _DeviceUsageList{} + + err = json.Unmarshal(data, &varDeviceUsageList) + + if err != nil { + return err + } + + *o = DeviceUsageList(varDeviceUsageList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "usages") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeviceUsageList struct { + value *DeviceUsageList + isSet bool +} + +func (v NullableDeviceUsageList) Get() *DeviceUsageList { + return v.value +} + +func (v *NullableDeviceUsageList) Set(val *DeviceUsageList) { + v.value = val + v.isSet = true +} + +func (v NullableDeviceUsageList) IsSet() bool { + return v.isSet +} + +func (v *NullableDeviceUsageList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeviceUsageList(val *DeviceUsageList) *NullableDeviceUsageList { + return &NullableDeviceUsageList{value: val, isSet: true} +} + +func (v NullableDeviceUsageList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeviceUsageList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_disk.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_disk.go new file mode 100644 index 00000000..b5f340d7 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_disk.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Disk type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Disk{} + +// Disk struct for Disk +type Disk struct { + Device *string `json:"device,omitempty"` + WipeTable *bool `json:"wipeTable,omitempty"` + Partitions []Partition `json:"partitions,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Disk Disk + +// NewDisk instantiates a new Disk object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDisk() *Disk { + this := Disk{} + return &this +} + +// NewDiskWithDefaults instantiates a new Disk object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDiskWithDefaults() *Disk { + this := Disk{} + return &this +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *Disk) GetDevice() string { + if o == nil || IsNil(o.Device) { + var ret string + return ret + } + return *o.Device +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Disk) GetDeviceOk() (*string, bool) { + if o == nil || IsNil(o.Device) { + return nil, false + } + return o.Device, true +} + +// HasDevice returns a boolean if a field has been set. +func (o *Disk) HasDevice() bool { + if o != nil && !IsNil(o.Device) { + return true + } + + return false +} + +// SetDevice gets a reference to the given string and assigns it to the Device field. +func (o *Disk) SetDevice(v string) { + o.Device = &v +} + +// GetWipeTable returns the WipeTable field value if set, zero value otherwise. +func (o *Disk) GetWipeTable() bool { + if o == nil || IsNil(o.WipeTable) { + var ret bool + return ret + } + return *o.WipeTable +} + +// GetWipeTableOk returns a tuple with the WipeTable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Disk) GetWipeTableOk() (*bool, bool) { + if o == nil || IsNil(o.WipeTable) { + return nil, false + } + return o.WipeTable, true +} + +// HasWipeTable returns a boolean if a field has been set. +func (o *Disk) HasWipeTable() bool { + if o != nil && !IsNil(o.WipeTable) { + return true + } + + return false +} + +// SetWipeTable gets a reference to the given bool and assigns it to the WipeTable field. +func (o *Disk) SetWipeTable(v bool) { + o.WipeTable = &v +} + +// GetPartitions returns the Partitions field value if set, zero value otherwise. +func (o *Disk) GetPartitions() []Partition { + if o == nil || IsNil(o.Partitions) { + var ret []Partition + return ret + } + return o.Partitions +} + +// GetPartitionsOk returns a tuple with the Partitions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Disk) GetPartitionsOk() ([]Partition, bool) { + if o == nil || IsNil(o.Partitions) { + return nil, false + } + return o.Partitions, true +} + +// HasPartitions returns a boolean if a field has been set. +func (o *Disk) HasPartitions() bool { + if o != nil && !IsNil(o.Partitions) { + return true + } + + return false +} + +// SetPartitions gets a reference to the given []Partition and assigns it to the Partitions field. +func (o *Disk) SetPartitions(v []Partition) { + o.Partitions = v +} + +func (o Disk) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Disk) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Device) { + toSerialize["device"] = o.Device + } + if !IsNil(o.WipeTable) { + toSerialize["wipeTable"] = o.WipeTable + } + if !IsNil(o.Partitions) { + toSerialize["partitions"] = o.Partitions + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Disk) UnmarshalJSON(data []byte) (err error) { + varDisk := _Disk{} + + err = json.Unmarshal(data, &varDisk) + + if err != nil { + return err + } + + *o = Disk(varDisk) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "device") + delete(additionalProperties, "wipeTable") + delete(additionalProperties, "partitions") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDisk struct { + value *Disk + isSet bool +} + +func (v NullableDisk) Get() *Disk { + return v.value +} + +func (v *NullableDisk) Set(val *Disk) { + v.value = val + v.isSet = true +} + +func (v NullableDisk) IsSet() bool { + return v.isSet +} + +func (v *NullableDisk) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDisk(val *Disk) *NullableDisk { + return &NullableDisk{value: val, isSet: true} +} + +func (v NullableDisk) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDisk) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_email.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_email.go new file mode 100644 index 00000000..1a5bf36b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_email.go @@ -0,0 +1,302 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Email type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Email{} + +// Email struct for Email +type Email struct { + Address *string `json:"address,omitempty"` + Default *bool `json:"default,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Verified *bool `json:"verified,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Email Email + +// NewEmail instantiates a new Email object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEmail() *Email { + this := Email{} + return &this +} + +// NewEmailWithDefaults instantiates a new Email object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEmailWithDefaults() *Email { + this := Email{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *Email) GetAddress() string { + if o == nil || IsNil(o.Address) { + var ret string + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Email) GetAddressOk() (*string, bool) { + if o == nil || IsNil(o.Address) { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *Email) HasAddress() bool { + if o != nil && !IsNil(o.Address) { + return true + } + + return false +} + +// SetAddress gets a reference to the given string and assigns it to the Address field. +func (o *Email) SetAddress(v string) { + o.Address = &v +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *Email) GetDefault() bool { + if o == nil || IsNil(o.Default) { + var ret bool + return ret + } + return *o.Default +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Email) GetDefaultOk() (*bool, bool) { + if o == nil || IsNil(o.Default) { + return nil, false + } + return o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *Email) HasDefault() bool { + if o != nil && !IsNil(o.Default) { + return true + } + + return false +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *Email) SetDefault(v bool) { + o.Default = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Email) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Email) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *Email) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Email) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Email) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Email) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Email) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Email) SetId(v string) { + o.Id = &v +} + +// GetVerified returns the Verified field value if set, zero value otherwise. +func (o *Email) GetVerified() bool { + if o == nil || IsNil(o.Verified) { + var ret bool + return ret + } + return *o.Verified +} + +// GetVerifiedOk returns a tuple with the Verified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Email) GetVerifiedOk() (*bool, bool) { + if o == nil || IsNil(o.Verified) { + return nil, false + } + return o.Verified, true +} + +// HasVerified returns a boolean if a field has been set. +func (o *Email) HasVerified() bool { + if o != nil && !IsNil(o.Verified) { + return true + } + + return false +} + +// SetVerified gets a reference to the given bool and assigns it to the Verified field. +func (o *Email) SetVerified(v bool) { + o.Verified = &v +} + +func (o Email) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Email) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Address) { + toSerialize["address"] = o.Address + } + if !IsNil(o.Default) { + toSerialize["default"] = o.Default + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Verified) { + toSerialize["verified"] = o.Verified + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Email) UnmarshalJSON(data []byte) (err error) { + varEmail := _Email{} + + err = json.Unmarshal(data, &varEmail) + + if err != nil { + return err + } + + *o = Email(varEmail) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "default") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "verified") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEmail struct { + value *Email + isSet bool +} + +func (v NullableEmail) Get() *Email { + return v.value +} + +func (v *NullableEmail) Set(val *Email) { + v.value = val + v.isSet = true +} + +func (v NullableEmail) IsSet() bool { + return v.isSet +} + +func (v *NullableEmail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEmail(val *Email) *NullableEmail { + return &NullableEmail{value: val, isSet: true} +} + +func (v NullableEmail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEmail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_email_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_email_input.go new file mode 100644 index 00000000..396262f3 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_email_input.go @@ -0,0 +1,204 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the EmailInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EmailInput{} + +// EmailInput struct for EmailInput +type EmailInput struct { + Address string `json:"address"` + Default *bool `json:"default,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _EmailInput EmailInput + +// NewEmailInput instantiates a new EmailInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEmailInput(address string) *EmailInput { + this := EmailInput{} + this.Address = address + return &this +} + +// NewEmailInputWithDefaults instantiates a new EmailInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEmailInputWithDefaults() *EmailInput { + this := EmailInput{} + return &this +} + +// GetAddress returns the Address field value +func (o *EmailInput) GetAddress() string { + if o == nil { + var ret string + return ret + } + + return o.Address +} + +// GetAddressOk returns a tuple with the Address field value +// and a boolean to check if the value has been set. +func (o *EmailInput) GetAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Address, true +} + +// SetAddress sets field value +func (o *EmailInput) SetAddress(v string) { + o.Address = v +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *EmailInput) GetDefault() bool { + if o == nil || IsNil(o.Default) { + var ret bool + return ret + } + return *o.Default +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EmailInput) GetDefaultOk() (*bool, bool) { + if o == nil || IsNil(o.Default) { + return nil, false + } + return o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *EmailInput) HasDefault() bool { + if o != nil && !IsNil(o.Default) { + return true + } + + return false +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *EmailInput) SetDefault(v bool) { + o.Default = &v +} + +func (o EmailInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EmailInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["address"] = o.Address + if !IsNil(o.Default) { + toSerialize["default"] = o.Default + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *EmailInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "address", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varEmailInput := _EmailInput{} + + err = json.Unmarshal(data, &varEmailInput) + + if err != nil { + return err + } + + *o = EmailInput(varEmailInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "default") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEmailInput struct { + value *EmailInput + isSet bool +} + +func (v NullableEmailInput) Get() *EmailInput { + return v.value +} + +func (v *NullableEmailInput) Set(val *EmailInput) { + v.value = val + v.isSet = true +} + +func (v NullableEmailInput) IsSet() bool { + return v.isSet +} + +func (v *NullableEmailInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEmailInput(val *EmailInput) *NullableEmailInput { + return &NullableEmailInput{value: val, isSet: true} +} + +func (v NullableEmailInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEmailInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_entitlement.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_entitlement.go new file mode 100644 index 00000000..cd6887ee --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_entitlement.go @@ -0,0 +1,562 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the Entitlement type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Entitlement{} + +// Entitlement struct for Entitlement +type Entitlement struct { + Description *string `json:"description,omitempty"` + FeatureAccess map[string]interface{} `json:"feature_access,omitempty"` + Href *string `json:"href,omitempty"` + Id string `json:"id"` + InstanceQuota map[string]interface{} `json:"instance_quota,omitempty"` + IpQuota map[string]interface{} `json:"ip_quota,omitempty"` + Name *string `json:"name,omitempty"` + ProjectQuota *int32 `json:"project_quota,omitempty"` + Slug string `json:"slug"` + VolumeLimits map[string]interface{} `json:"volume_limits,omitempty"` + VolumeQuota map[string]interface{} `json:"volume_quota,omitempty"` + Weight int32 `json:"weight"` + AdditionalProperties map[string]interface{} +} + +type _Entitlement Entitlement + +// NewEntitlement instantiates a new Entitlement object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEntitlement(id string, slug string, weight int32) *Entitlement { + this := Entitlement{} + this.Id = id + var projectQuota int32 = 0 + this.ProjectQuota = &projectQuota + this.Slug = slug + this.Weight = weight + return &this +} + +// NewEntitlementWithDefaults instantiates a new Entitlement object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEntitlementWithDefaults() *Entitlement { + this := Entitlement{} + var projectQuota int32 = 0 + this.ProjectQuota = &projectQuota + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Entitlement) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Entitlement) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Entitlement) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Entitlement) SetDescription(v string) { + o.Description = &v +} + +// GetFeatureAccess returns the FeatureAccess field value if set, zero value otherwise. +func (o *Entitlement) GetFeatureAccess() map[string]interface{} { + if o == nil || IsNil(o.FeatureAccess) { + var ret map[string]interface{} + return ret + } + return o.FeatureAccess +} + +// GetFeatureAccessOk returns a tuple with the FeatureAccess field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Entitlement) GetFeatureAccessOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.FeatureAccess) { + return map[string]interface{}{}, false + } + return o.FeatureAccess, true +} + +// HasFeatureAccess returns a boolean if a field has been set. +func (o *Entitlement) HasFeatureAccess() bool { + if o != nil && !IsNil(o.FeatureAccess) { + return true + } + + return false +} + +// SetFeatureAccess gets a reference to the given map[string]interface{} and assigns it to the FeatureAccess field. +func (o *Entitlement) SetFeatureAccess(v map[string]interface{}) { + o.FeatureAccess = v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Entitlement) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Entitlement) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *Entitlement) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Entitlement) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value +func (o *Entitlement) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Entitlement) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Entitlement) SetId(v string) { + o.Id = v +} + +// GetInstanceQuota returns the InstanceQuota field value if set, zero value otherwise. +func (o *Entitlement) GetInstanceQuota() map[string]interface{} { + if o == nil || IsNil(o.InstanceQuota) { + var ret map[string]interface{} + return ret + } + return o.InstanceQuota +} + +// GetInstanceQuotaOk returns a tuple with the InstanceQuota field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Entitlement) GetInstanceQuotaOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.InstanceQuota) { + return map[string]interface{}{}, false + } + return o.InstanceQuota, true +} + +// HasInstanceQuota returns a boolean if a field has been set. +func (o *Entitlement) HasInstanceQuota() bool { + if o != nil && !IsNil(o.InstanceQuota) { + return true + } + + return false +} + +// SetInstanceQuota gets a reference to the given map[string]interface{} and assigns it to the InstanceQuota field. +func (o *Entitlement) SetInstanceQuota(v map[string]interface{}) { + o.InstanceQuota = v +} + +// GetIpQuota returns the IpQuota field value if set, zero value otherwise. +func (o *Entitlement) GetIpQuota() map[string]interface{} { + if o == nil || IsNil(o.IpQuota) { + var ret map[string]interface{} + return ret + } + return o.IpQuota +} + +// GetIpQuotaOk returns a tuple with the IpQuota field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Entitlement) GetIpQuotaOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.IpQuota) { + return map[string]interface{}{}, false + } + return o.IpQuota, true +} + +// HasIpQuota returns a boolean if a field has been set. +func (o *Entitlement) HasIpQuota() bool { + if o != nil && !IsNil(o.IpQuota) { + return true + } + + return false +} + +// SetIpQuota gets a reference to the given map[string]interface{} and assigns it to the IpQuota field. +func (o *Entitlement) SetIpQuota(v map[string]interface{}) { + o.IpQuota = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Entitlement) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Entitlement) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Entitlement) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Entitlement) SetName(v string) { + o.Name = &v +} + +// GetProjectQuota returns the ProjectQuota field value if set, zero value otherwise. +func (o *Entitlement) GetProjectQuota() int32 { + if o == nil || IsNil(o.ProjectQuota) { + var ret int32 + return ret + } + return *o.ProjectQuota +} + +// GetProjectQuotaOk returns a tuple with the ProjectQuota field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Entitlement) GetProjectQuotaOk() (*int32, bool) { + if o == nil || IsNil(o.ProjectQuota) { + return nil, false + } + return o.ProjectQuota, true +} + +// HasProjectQuota returns a boolean if a field has been set. +func (o *Entitlement) HasProjectQuota() bool { + if o != nil && !IsNil(o.ProjectQuota) { + return true + } + + return false +} + +// SetProjectQuota gets a reference to the given int32 and assigns it to the ProjectQuota field. +func (o *Entitlement) SetProjectQuota(v int32) { + o.ProjectQuota = &v +} + +// GetSlug returns the Slug field value +func (o *Entitlement) GetSlug() string { + if o == nil { + var ret string + return ret + } + + return o.Slug +} + +// GetSlugOk returns a tuple with the Slug field value +// and a boolean to check if the value has been set. +func (o *Entitlement) GetSlugOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Slug, true +} + +// SetSlug sets field value +func (o *Entitlement) SetSlug(v string) { + o.Slug = v +} + +// GetVolumeLimits returns the VolumeLimits field value if set, zero value otherwise. +func (o *Entitlement) GetVolumeLimits() map[string]interface{} { + if o == nil || IsNil(o.VolumeLimits) { + var ret map[string]interface{} + return ret + } + return o.VolumeLimits +} + +// GetVolumeLimitsOk returns a tuple with the VolumeLimits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Entitlement) GetVolumeLimitsOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.VolumeLimits) { + return map[string]interface{}{}, false + } + return o.VolumeLimits, true +} + +// HasVolumeLimits returns a boolean if a field has been set. +func (o *Entitlement) HasVolumeLimits() bool { + if o != nil && !IsNil(o.VolumeLimits) { + return true + } + + return false +} + +// SetVolumeLimits gets a reference to the given map[string]interface{} and assigns it to the VolumeLimits field. +func (o *Entitlement) SetVolumeLimits(v map[string]interface{}) { + o.VolumeLimits = v +} + +// GetVolumeQuota returns the VolumeQuota field value if set, zero value otherwise. +func (o *Entitlement) GetVolumeQuota() map[string]interface{} { + if o == nil || IsNil(o.VolumeQuota) { + var ret map[string]interface{} + return ret + } + return o.VolumeQuota +} + +// GetVolumeQuotaOk returns a tuple with the VolumeQuota field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Entitlement) GetVolumeQuotaOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.VolumeQuota) { + return map[string]interface{}{}, false + } + return o.VolumeQuota, true +} + +// HasVolumeQuota returns a boolean if a field has been set. +func (o *Entitlement) HasVolumeQuota() bool { + if o != nil && !IsNil(o.VolumeQuota) { + return true + } + + return false +} + +// SetVolumeQuota gets a reference to the given map[string]interface{} and assigns it to the VolumeQuota field. +func (o *Entitlement) SetVolumeQuota(v map[string]interface{}) { + o.VolumeQuota = v +} + +// GetWeight returns the Weight field value +func (o *Entitlement) GetWeight() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Weight +} + +// GetWeightOk returns a tuple with the Weight field value +// and a boolean to check if the value has been set. +func (o *Entitlement) GetWeightOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Weight, true +} + +// SetWeight sets field value +func (o *Entitlement) SetWeight(v int32) { + o.Weight = v +} + +func (o Entitlement) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Entitlement) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.FeatureAccess) { + toSerialize["feature_access"] = o.FeatureAccess + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + toSerialize["id"] = o.Id + if !IsNil(o.InstanceQuota) { + toSerialize["instance_quota"] = o.InstanceQuota + } + if !IsNil(o.IpQuota) { + toSerialize["ip_quota"] = o.IpQuota + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.ProjectQuota) { + toSerialize["project_quota"] = o.ProjectQuota + } + toSerialize["slug"] = o.Slug + if !IsNil(o.VolumeLimits) { + toSerialize["volume_limits"] = o.VolumeLimits + } + if !IsNil(o.VolumeQuota) { + toSerialize["volume_quota"] = o.VolumeQuota + } + toSerialize["weight"] = o.Weight + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Entitlement) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "slug", + "weight", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varEntitlement := _Entitlement{} + + err = json.Unmarshal(data, &varEntitlement) + + if err != nil { + return err + } + + *o = Entitlement(varEntitlement) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "feature_access") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "instance_quota") + delete(additionalProperties, "ip_quota") + delete(additionalProperties, "name") + delete(additionalProperties, "project_quota") + delete(additionalProperties, "slug") + delete(additionalProperties, "volume_limits") + delete(additionalProperties, "volume_quota") + delete(additionalProperties, "weight") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEntitlement struct { + value *Entitlement + isSet bool +} + +func (v NullableEntitlement) Get() *Entitlement { + return v.value +} + +func (v *NullableEntitlement) Set(val *Entitlement) { + v.value = val + v.isSet = true +} + +func (v NullableEntitlement) IsSet() bool { + return v.isSet +} + +func (v *NullableEntitlement) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEntitlement(val *Entitlement) *NullableEntitlement { + return &NullableEntitlement{value: val, isSet: true} +} + +func (v NullableEntitlement) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEntitlement) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_error.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_error.go new file mode 100644 index 00000000..31e4d416 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_error.go @@ -0,0 +1,193 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Error type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Error{} + +// Error Error responses are included with 4xx and 5xx HTTP responses from the API service. Either \"error\" or \"errors\" will be set. +type Error struct { + // A description of the error that caused the request to fail. + Error *string `json:"error,omitempty"` + // A list of errors that contributed to the request failing. + Errors []string `json:"errors,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Error Error + +// NewError instantiates a new Error object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewError() *Error { + this := Error{} + return &this +} + +// NewErrorWithDefaults instantiates a new Error object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorWithDefaults() *Error { + this := Error{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *Error) GetError() string { + if o == nil || IsNil(o.Error) { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Error) GetErrorOk() (*string, bool) { + if o == nil || IsNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *Error) HasError() bool { + if o != nil && !IsNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *Error) SetError(v string) { + o.Error = &v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *Error) GetErrors() []string { + if o == nil || IsNil(o.Errors) { + var ret []string + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Error) GetErrorsOk() ([]string, bool) { + if o == nil || IsNil(o.Errors) { + return nil, false + } + return o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *Error) HasErrors() bool { + if o != nil && !IsNil(o.Errors) { + return true + } + + return false +} + +// SetErrors gets a reference to the given []string and assigns it to the Errors field. +func (o *Error) SetErrors(v []string) { + o.Errors = v +} + +func (o Error) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Error) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Error) { + toSerialize["error"] = o.Error + } + if !IsNil(o.Errors) { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Error) UnmarshalJSON(data []byte) (err error) { + varError := _Error{} + + err = json.Unmarshal(data, &varError) + + if err != nil { + return err + } + + *o = Error(varError) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + delete(additionalProperties, "errors") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_event.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_event.go new file mode 100644 index 00000000..890825c4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_event.go @@ -0,0 +1,488 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the Event type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Event{} + +// Event struct for Event +type Event struct { + Body *string `json:"body,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Interpolated *string `json:"interpolated,omitempty"` + Relationships []Href `json:"relationships,omitempty"` + State *string `json:"state,omitempty"` + Type *string `json:"type,omitempty"` + ModifiedBy map[string]interface{} `json:"modified_by,omitempty"` + Ip *string `json:"ip,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Event Event + +// NewEvent instantiates a new Event object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEvent() *Event { + this := Event{} + return &this +} + +// NewEventWithDefaults instantiates a new Event object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEventWithDefaults() *Event { + this := Event{} + return &this +} + +// GetBody returns the Body field value if set, zero value otherwise. +func (o *Event) GetBody() string { + if o == nil || IsNil(o.Body) { + var ret string + return ret + } + return *o.Body +} + +// GetBodyOk returns a tuple with the Body field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetBodyOk() (*string, bool) { + if o == nil || IsNil(o.Body) { + return nil, false + } + return o.Body, true +} + +// HasBody returns a boolean if a field has been set. +func (o *Event) HasBody() bool { + if o != nil && !IsNil(o.Body) { + return true + } + + return false +} + +// SetBody gets a reference to the given string and assigns it to the Body field. +func (o *Event) SetBody(v string) { + o.Body = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Event) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Event) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Event) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Event) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *Event) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Event) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Event) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Event) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Event) SetId(v string) { + o.Id = &v +} + +// GetInterpolated returns the Interpolated field value if set, zero value otherwise. +func (o *Event) GetInterpolated() string { + if o == nil || IsNil(o.Interpolated) { + var ret string + return ret + } + return *o.Interpolated +} + +// GetInterpolatedOk returns a tuple with the Interpolated field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetInterpolatedOk() (*string, bool) { + if o == nil || IsNil(o.Interpolated) { + return nil, false + } + return o.Interpolated, true +} + +// HasInterpolated returns a boolean if a field has been set. +func (o *Event) HasInterpolated() bool { + if o != nil && !IsNil(o.Interpolated) { + return true + } + + return false +} + +// SetInterpolated gets a reference to the given string and assigns it to the Interpolated field. +func (o *Event) SetInterpolated(v string) { + o.Interpolated = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *Event) GetRelationships() []Href { + if o == nil || IsNil(o.Relationships) { + var ret []Href + return ret + } + return o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetRelationshipsOk() ([]Href, bool) { + if o == nil || IsNil(o.Relationships) { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *Event) HasRelationships() bool { + if o != nil && !IsNil(o.Relationships) { + return true + } + + return false +} + +// SetRelationships gets a reference to the given []Href and assigns it to the Relationships field. +func (o *Event) SetRelationships(v []Href) { + o.Relationships = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Event) GetState() string { + if o == nil || IsNil(o.State) { + var ret string + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetStateOk() (*string, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Event) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *Event) SetState(v string) { + o.State = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Event) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Event) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Event) SetType(v string) { + o.Type = &v +} + +// GetModifiedBy returns the ModifiedBy field value if set, zero value otherwise. +func (o *Event) GetModifiedBy() map[string]interface{} { + if o == nil || IsNil(o.ModifiedBy) { + var ret map[string]interface{} + return ret + } + return o.ModifiedBy +} + +// GetModifiedByOk returns a tuple with the ModifiedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetModifiedByOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.ModifiedBy) { + return map[string]interface{}{}, false + } + return o.ModifiedBy, true +} + +// HasModifiedBy returns a boolean if a field has been set. +func (o *Event) HasModifiedBy() bool { + if o != nil && !IsNil(o.ModifiedBy) { + return true + } + + return false +} + +// SetModifiedBy gets a reference to the given map[string]interface{} and assigns it to the ModifiedBy field. +func (o *Event) SetModifiedBy(v map[string]interface{}) { + o.ModifiedBy = v +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *Event) GetIp() string { + if o == nil || IsNil(o.Ip) { + var ret string + return ret + } + return *o.Ip +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Event) GetIpOk() (*string, bool) { + if o == nil || IsNil(o.Ip) { + return nil, false + } + return o.Ip, true +} + +// HasIp returns a boolean if a field has been set. +func (o *Event) HasIp() bool { + if o != nil && !IsNil(o.Ip) { + return true + } + + return false +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *Event) SetIp(v string) { + o.Ip = &v +} + +func (o Event) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Event) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Body) { + toSerialize["body"] = o.Body + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Interpolated) { + toSerialize["interpolated"] = o.Interpolated + } + if !IsNil(o.Relationships) { + toSerialize["relationships"] = o.Relationships + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.ModifiedBy) { + toSerialize["modified_by"] = o.ModifiedBy + } + if !IsNil(o.Ip) { + toSerialize["ip"] = o.Ip + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Event) UnmarshalJSON(data []byte) (err error) { + varEvent := _Event{} + + err = json.Unmarshal(data, &varEvent) + + if err != nil { + return err + } + + *o = Event(varEvent) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "body") + delete(additionalProperties, "created_at") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "interpolated") + delete(additionalProperties, "relationships") + delete(additionalProperties, "state") + delete(additionalProperties, "type") + delete(additionalProperties, "modified_by") + delete(additionalProperties, "ip") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEvent struct { + value *Event + isSet bool +} + +func (v NullableEvent) Get() *Event { + return v.value +} + +func (v *NullableEvent) Set(val *Event) { + v.value = val + v.isSet = true +} + +func (v NullableEvent) IsSet() bool { + return v.isSet +} + +func (v *NullableEvent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEvent(val *Event) *NullableEvent { + return &NullableEvent{value: val, isSet: true} +} + +func (v NullableEvent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEvent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_event_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_event_list.go new file mode 100644 index 00000000..8c9a9fce --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_event_list.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the EventList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EventList{} + +// EventList struct for EventList +type EventList struct { + Events []Event `json:"events,omitempty"` + Meta *Meta `json:"meta,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _EventList EventList + +// NewEventList instantiates a new EventList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEventList() *EventList { + this := EventList{} + return &this +} + +// NewEventListWithDefaults instantiates a new EventList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEventListWithDefaults() *EventList { + this := EventList{} + return &this +} + +// GetEvents returns the Events field value if set, zero value otherwise. +func (o *EventList) GetEvents() []Event { + if o == nil || IsNil(o.Events) { + var ret []Event + return ret + } + return o.Events +} + +// GetEventsOk returns a tuple with the Events field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventList) GetEventsOk() ([]Event, bool) { + if o == nil || IsNil(o.Events) { + return nil, false + } + return o.Events, true +} + +// HasEvents returns a boolean if a field has been set. +func (o *EventList) HasEvents() bool { + if o != nil && !IsNil(o.Events) { + return true + } + + return false +} + +// SetEvents gets a reference to the given []Event and assigns it to the Events field. +func (o *EventList) SetEvents(v []Event) { + o.Events = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *EventList) GetMeta() Meta { + if o == nil || IsNil(o.Meta) { + var ret Meta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EventList) GetMetaOk() (*Meta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *EventList) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given Meta and assigns it to the Meta field. +func (o *EventList) SetMeta(v Meta) { + o.Meta = &v +} + +func (o EventList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EventList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Events) { + toSerialize["events"] = o.Events + } + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *EventList) UnmarshalJSON(data []byte) (err error) { + varEventList := _EventList{} + + err = json.Unmarshal(data, &varEventList) + + if err != nil { + return err + } + + *o = EventList(varEventList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "events") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEventList struct { + value *EventList + isSet bool +} + +func (v NullableEventList) Get() *EventList { + return v.value +} + +func (v *NullableEventList) Set(val *EventList) { + v.value = val + v.isSet = true +} + +func (v NullableEventList) IsSet() bool { + return v.isSet +} + +func (v *NullableEventList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEventList(val *EventList) *NullableEventList { + return &NullableEventList{value: val, isSet: true} +} + +func (v NullableEventList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEventList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token.go new file mode 100644 index 00000000..ec09d971 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token.go @@ -0,0 +1,343 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the FabricServiceToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FabricServiceToken{} + +// FabricServiceToken struct for FabricServiceToken +type FabricServiceToken struct { + // The expiration date and time of the Fabric service token. Once a service token is expired, it is no longer redeemable. + ExpiresAt *time.Time `json:"expires_at,omitempty"` + // The UUID that can be used on the Fabric Portal to redeem either an A-Side or Z-Side Service Token. For Fabric VCs (Metal Billed), this UUID will represent an A-Side Service Token, which will allow interconnections to be made from Equinix Metal to other Service Providers on Fabric. For Fabric VCs (Fabric Billed), this UUID will represent a Z-Side Service Token, which will allow interconnections to be made to connect an owned Fabric Port or Virtual Device to Equinix Metal. + Id *string `json:"id,omitempty"` + // The maximum speed that can be selected on the Fabric Portal when configuring a interconnection with either an A-Side or Z-Side Service Token. For Fabric VCs (Metal Billed), this is what the billing is based off of, and can be one of the following options, '50mbps', '200mbps', '500mbps', '1gbps', '2gbps', '5gbps' or '10gbps'. For Fabric VCs (Fabric Billed), this will default to 10Gbps. + MaxAllowedSpeed *int64 `json:"max_allowed_speed,omitempty"` + Role *FabricServiceTokenRole `json:"role,omitempty"` + ServiceTokenType *FabricServiceTokenServiceTokenType `json:"service_token_type,omitempty"` + State *FabricServiceTokenState `json:"state,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _FabricServiceToken FabricServiceToken + +// NewFabricServiceToken instantiates a new FabricServiceToken object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFabricServiceToken() *FabricServiceToken { + this := FabricServiceToken{} + return &this +} + +// NewFabricServiceTokenWithDefaults instantiates a new FabricServiceToken object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFabricServiceTokenWithDefaults() *FabricServiceToken { + this := FabricServiceToken{} + return &this +} + +// GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. +func (o *FabricServiceToken) GetExpiresAt() time.Time { + if o == nil || IsNil(o.ExpiresAt) { + var ret time.Time + return ret + } + return *o.ExpiresAt +} + +// GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FabricServiceToken) GetExpiresAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.ExpiresAt) { + return nil, false + } + return o.ExpiresAt, true +} + +// HasExpiresAt returns a boolean if a field has been set. +func (o *FabricServiceToken) HasExpiresAt() bool { + if o != nil && !IsNil(o.ExpiresAt) { + return true + } + + return false +} + +// SetExpiresAt gets a reference to the given time.Time and assigns it to the ExpiresAt field. +func (o *FabricServiceToken) SetExpiresAt(v time.Time) { + o.ExpiresAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *FabricServiceToken) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FabricServiceToken) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *FabricServiceToken) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *FabricServiceToken) SetId(v string) { + o.Id = &v +} + +// GetMaxAllowedSpeed returns the MaxAllowedSpeed field value if set, zero value otherwise. +func (o *FabricServiceToken) GetMaxAllowedSpeed() int64 { + if o == nil || IsNil(o.MaxAllowedSpeed) { + var ret int64 + return ret + } + return *o.MaxAllowedSpeed +} + +// GetMaxAllowedSpeedOk returns a tuple with the MaxAllowedSpeed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FabricServiceToken) GetMaxAllowedSpeedOk() (*int64, bool) { + if o == nil || IsNil(o.MaxAllowedSpeed) { + return nil, false + } + return o.MaxAllowedSpeed, true +} + +// HasMaxAllowedSpeed returns a boolean if a field has been set. +func (o *FabricServiceToken) HasMaxAllowedSpeed() bool { + if o != nil && !IsNil(o.MaxAllowedSpeed) { + return true + } + + return false +} + +// SetMaxAllowedSpeed gets a reference to the given int64 and assigns it to the MaxAllowedSpeed field. +func (o *FabricServiceToken) SetMaxAllowedSpeed(v int64) { + o.MaxAllowedSpeed = &v +} + +// GetRole returns the Role field value if set, zero value otherwise. +func (o *FabricServiceToken) GetRole() FabricServiceTokenRole { + if o == nil || IsNil(o.Role) { + var ret FabricServiceTokenRole + return ret + } + return *o.Role +} + +// GetRoleOk returns a tuple with the Role field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FabricServiceToken) GetRoleOk() (*FabricServiceTokenRole, bool) { + if o == nil || IsNil(o.Role) { + return nil, false + } + return o.Role, true +} + +// HasRole returns a boolean if a field has been set. +func (o *FabricServiceToken) HasRole() bool { + if o != nil && !IsNil(o.Role) { + return true + } + + return false +} + +// SetRole gets a reference to the given FabricServiceTokenRole and assigns it to the Role field. +func (o *FabricServiceToken) SetRole(v FabricServiceTokenRole) { + o.Role = &v +} + +// GetServiceTokenType returns the ServiceTokenType field value if set, zero value otherwise. +func (o *FabricServiceToken) GetServiceTokenType() FabricServiceTokenServiceTokenType { + if o == nil || IsNil(o.ServiceTokenType) { + var ret FabricServiceTokenServiceTokenType + return ret + } + return *o.ServiceTokenType +} + +// GetServiceTokenTypeOk returns a tuple with the ServiceTokenType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FabricServiceToken) GetServiceTokenTypeOk() (*FabricServiceTokenServiceTokenType, bool) { + if o == nil || IsNil(o.ServiceTokenType) { + return nil, false + } + return o.ServiceTokenType, true +} + +// HasServiceTokenType returns a boolean if a field has been set. +func (o *FabricServiceToken) HasServiceTokenType() bool { + if o != nil && !IsNil(o.ServiceTokenType) { + return true + } + + return false +} + +// SetServiceTokenType gets a reference to the given FabricServiceTokenServiceTokenType and assigns it to the ServiceTokenType field. +func (o *FabricServiceToken) SetServiceTokenType(v FabricServiceTokenServiceTokenType) { + o.ServiceTokenType = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *FabricServiceToken) GetState() FabricServiceTokenState { + if o == nil || IsNil(o.State) { + var ret FabricServiceTokenState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FabricServiceToken) GetStateOk() (*FabricServiceTokenState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *FabricServiceToken) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given FabricServiceTokenState and assigns it to the State field. +func (o *FabricServiceToken) SetState(v FabricServiceTokenState) { + o.State = &v +} + +func (o FabricServiceToken) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FabricServiceToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ExpiresAt) { + toSerialize["expires_at"] = o.ExpiresAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.MaxAllowedSpeed) { + toSerialize["max_allowed_speed"] = o.MaxAllowedSpeed + } + if !IsNil(o.Role) { + toSerialize["role"] = o.Role + } + if !IsNil(o.ServiceTokenType) { + toSerialize["service_token_type"] = o.ServiceTokenType + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FabricServiceToken) UnmarshalJSON(data []byte) (err error) { + varFabricServiceToken := _FabricServiceToken{} + + err = json.Unmarshal(data, &varFabricServiceToken) + + if err != nil { + return err + } + + *o = FabricServiceToken(varFabricServiceToken) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "expires_at") + delete(additionalProperties, "id") + delete(additionalProperties, "max_allowed_speed") + delete(additionalProperties, "role") + delete(additionalProperties, "service_token_type") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFabricServiceToken struct { + value *FabricServiceToken + isSet bool +} + +func (v NullableFabricServiceToken) Get() *FabricServiceToken { + return v.value +} + +func (v *NullableFabricServiceToken) Set(val *FabricServiceToken) { + v.value = val + v.isSet = true +} + +func (v NullableFabricServiceToken) IsSet() bool { + return v.isSet +} + +func (v *NullableFabricServiceToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFabricServiceToken(val *FabricServiceToken) *NullableFabricServiceToken { + return &NullableFabricServiceToken{value: val, isSet: true} +} + +func (v NullableFabricServiceToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFabricServiceToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_role.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_role.go new file mode 100644 index 00000000..859d5e43 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_role.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FabricServiceTokenRole Either primary or secondary, depending on which interconnection the service token is associated to. +type FabricServiceTokenRole string + +// List of FabricServiceToken_role +const ( + FABRICSERVICETOKENROLE_PRIMARY FabricServiceTokenRole = "primary" + FABRICSERVICETOKENROLE_SECONDARY FabricServiceTokenRole = "secondary" +) + +// All allowed values of FabricServiceTokenRole enum +var AllowedFabricServiceTokenRoleEnumValues = []FabricServiceTokenRole{ + "primary", + "secondary", +} + +func (v *FabricServiceTokenRole) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FabricServiceTokenRole(value) + for _, existing := range AllowedFabricServiceTokenRoleEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FabricServiceTokenRole", value) +} + +// NewFabricServiceTokenRoleFromValue returns a pointer to a valid FabricServiceTokenRole +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFabricServiceTokenRoleFromValue(v string) (*FabricServiceTokenRole, error) { + ev := FabricServiceTokenRole(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FabricServiceTokenRole: valid values are %v", v, AllowedFabricServiceTokenRoleEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FabricServiceTokenRole) IsValid() bool { + for _, existing := range AllowedFabricServiceTokenRoleEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FabricServiceToken_role value +func (v FabricServiceTokenRole) Ptr() *FabricServiceTokenRole { + return &v +} + +type NullableFabricServiceTokenRole struct { + value *FabricServiceTokenRole + isSet bool +} + +func (v NullableFabricServiceTokenRole) Get() *FabricServiceTokenRole { + return v.value +} + +func (v *NullableFabricServiceTokenRole) Set(val *FabricServiceTokenRole) { + v.value = val + v.isSet = true +} + +func (v NullableFabricServiceTokenRole) IsSet() bool { + return v.isSet +} + +func (v *NullableFabricServiceTokenRole) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFabricServiceTokenRole(val *FabricServiceTokenRole) *NullableFabricServiceTokenRole { + return &NullableFabricServiceTokenRole{value: val, isSet: true} +} + +func (v NullableFabricServiceTokenRole) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFabricServiceTokenRole) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_service_token_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_service_token_type.go new file mode 100644 index 00000000..af7474b8 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_service_token_type.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FabricServiceTokenServiceTokenType Either 'a_side' or 'z_side', depending on which type of Fabric VC was requested. +type FabricServiceTokenServiceTokenType string + +// List of FabricServiceToken_service_token_type +const ( + FABRICSERVICETOKENSERVICETOKENTYPE_A_SIDE FabricServiceTokenServiceTokenType = "a_side" + FABRICSERVICETOKENSERVICETOKENTYPE_Z_SIDE FabricServiceTokenServiceTokenType = "z_side" +) + +// All allowed values of FabricServiceTokenServiceTokenType enum +var AllowedFabricServiceTokenServiceTokenTypeEnumValues = []FabricServiceTokenServiceTokenType{ + "a_side", + "z_side", +} + +func (v *FabricServiceTokenServiceTokenType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FabricServiceTokenServiceTokenType(value) + for _, existing := range AllowedFabricServiceTokenServiceTokenTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FabricServiceTokenServiceTokenType", value) +} + +// NewFabricServiceTokenServiceTokenTypeFromValue returns a pointer to a valid FabricServiceTokenServiceTokenType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFabricServiceTokenServiceTokenTypeFromValue(v string) (*FabricServiceTokenServiceTokenType, error) { + ev := FabricServiceTokenServiceTokenType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FabricServiceTokenServiceTokenType: valid values are %v", v, AllowedFabricServiceTokenServiceTokenTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FabricServiceTokenServiceTokenType) IsValid() bool { + for _, existing := range AllowedFabricServiceTokenServiceTokenTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FabricServiceToken_service_token_type value +func (v FabricServiceTokenServiceTokenType) Ptr() *FabricServiceTokenServiceTokenType { + return &v +} + +type NullableFabricServiceTokenServiceTokenType struct { + value *FabricServiceTokenServiceTokenType + isSet bool +} + +func (v NullableFabricServiceTokenServiceTokenType) Get() *FabricServiceTokenServiceTokenType { + return v.value +} + +func (v *NullableFabricServiceTokenServiceTokenType) Set(val *FabricServiceTokenServiceTokenType) { + v.value = val + v.isSet = true +} + +func (v NullableFabricServiceTokenServiceTokenType) IsSet() bool { + return v.isSet +} + +func (v *NullableFabricServiceTokenServiceTokenType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFabricServiceTokenServiceTokenType(val *FabricServiceTokenServiceTokenType) *NullableFabricServiceTokenServiceTokenType { + return &NullableFabricServiceTokenServiceTokenType{value: val, isSet: true} +} + +func (v NullableFabricServiceTokenServiceTokenType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFabricServiceTokenServiceTokenType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_state.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_state.go new file mode 100644 index 00000000..935da44c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_fabric_service_token_state.go @@ -0,0 +1,113 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FabricServiceTokenState The state of the service token that corresponds with the service token state on Fabric. An 'inactive' state refers to a token that has not been redeemed yet on the Fabric side, an 'active' state refers to a token that has already been redeemed, and an 'expired' state refers to a token that has reached its expiry time. +type FabricServiceTokenState string + +// List of FabricServiceToken_state +const ( + FABRICSERVICETOKENSTATE_INACTIVE FabricServiceTokenState = "inactive" + FABRICSERVICETOKENSTATE_ACTIVE FabricServiceTokenState = "active" + FABRICSERVICETOKENSTATE_EXPIRED FabricServiceTokenState = "expired" +) + +// All allowed values of FabricServiceTokenState enum +var AllowedFabricServiceTokenStateEnumValues = []FabricServiceTokenState{ + "inactive", + "active", + "expired", +} + +func (v *FabricServiceTokenState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FabricServiceTokenState(value) + for _, existing := range AllowedFabricServiceTokenStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FabricServiceTokenState", value) +} + +// NewFabricServiceTokenStateFromValue returns a pointer to a valid FabricServiceTokenState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFabricServiceTokenStateFromValue(v string) (*FabricServiceTokenState, error) { + ev := FabricServiceTokenState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FabricServiceTokenState: valid values are %v", v, AllowedFabricServiceTokenStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FabricServiceTokenState) IsValid() bool { + for _, existing := range AllowedFabricServiceTokenStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FabricServiceToken_state value +func (v FabricServiceTokenState) Ptr() *FabricServiceTokenState { + return &v +} + +type NullableFabricServiceTokenState struct { + value *FabricServiceTokenState + isSet bool +} + +func (v NullableFabricServiceTokenState) Get() *FabricServiceTokenState { + return v.value +} + +func (v *NullableFabricServiceTokenState) Set(val *FabricServiceTokenState) { + v.value = val + v.isSet = true +} + +func (v NullableFabricServiceTokenState) IsSet() bool { + return v.isSet +} + +func (v *NullableFabricServiceTokenState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFabricServiceTokenState(val *FabricServiceTokenState) *NullableFabricServiceTokenState { + return &NullableFabricServiceTokenState{value: val, isSet: true} +} + +func (v NullableFabricServiceTokenState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFabricServiceTokenState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility.go new file mode 100644 index 00000000..7ae7301d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility.go @@ -0,0 +1,377 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Facility type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Facility{} + +// Facility struct for Facility +type Facility struct { + Address *Address `json:"address,omitempty"` + Code *string `json:"code,omitempty"` + Features []FacilityFeaturesInner `json:"features,omitempty"` + Id *string `json:"id,omitempty"` + // IP ranges registered in facility. Can be used for GeoIP location + IpRanges []string `json:"ip_ranges,omitempty"` + Metro *DeviceMetro `json:"metro,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Facility Facility + +// NewFacility instantiates a new Facility object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFacility() *Facility { + this := Facility{} + return &this +} + +// NewFacilityWithDefaults instantiates a new Facility object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFacilityWithDefaults() *Facility { + this := Facility{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *Facility) GetAddress() Address { + if o == nil || IsNil(o.Address) { + var ret Address + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Facility) GetAddressOk() (*Address, bool) { + if o == nil || IsNil(o.Address) { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *Facility) HasAddress() bool { + if o != nil && !IsNil(o.Address) { + return true + } + + return false +} + +// SetAddress gets a reference to the given Address and assigns it to the Address field. +func (o *Facility) SetAddress(v Address) { + o.Address = &v +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *Facility) GetCode() string { + if o == nil || IsNil(o.Code) { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Facility) GetCodeOk() (*string, bool) { + if o == nil || IsNil(o.Code) { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *Facility) HasCode() bool { + if o != nil && !IsNil(o.Code) { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *Facility) SetCode(v string) { + o.Code = &v +} + +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *Facility) GetFeatures() []FacilityFeaturesInner { + if o == nil || IsNil(o.Features) { + var ret []FacilityFeaturesInner + return ret + } + return o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Facility) GetFeaturesOk() ([]FacilityFeaturesInner, bool) { + if o == nil || IsNil(o.Features) { + return nil, false + } + return o.Features, true +} + +// HasFeatures returns a boolean if a field has been set. +func (o *Facility) HasFeatures() bool { + if o != nil && !IsNil(o.Features) { + return true + } + + return false +} + +// SetFeatures gets a reference to the given []FacilityFeaturesInner and assigns it to the Features field. +func (o *Facility) SetFeatures(v []FacilityFeaturesInner) { + o.Features = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Facility) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Facility) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Facility) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Facility) SetId(v string) { + o.Id = &v +} + +// GetIpRanges returns the IpRanges field value if set, zero value otherwise. +func (o *Facility) GetIpRanges() []string { + if o == nil || IsNil(o.IpRanges) { + var ret []string + return ret + } + return o.IpRanges +} + +// GetIpRangesOk returns a tuple with the IpRanges field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Facility) GetIpRangesOk() ([]string, bool) { + if o == nil || IsNil(o.IpRanges) { + return nil, false + } + return o.IpRanges, true +} + +// HasIpRanges returns a boolean if a field has been set. +func (o *Facility) HasIpRanges() bool { + if o != nil && !IsNil(o.IpRanges) { + return true + } + + return false +} + +// SetIpRanges gets a reference to the given []string and assigns it to the IpRanges field. +func (o *Facility) SetIpRanges(v []string) { + o.IpRanges = v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *Facility) GetMetro() DeviceMetro { + if o == nil || IsNil(o.Metro) { + var ret DeviceMetro + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Facility) GetMetroOk() (*DeviceMetro, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *Facility) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given DeviceMetro and assigns it to the Metro field. +func (o *Facility) SetMetro(v DeviceMetro) { + o.Metro = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Facility) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Facility) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Facility) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Facility) SetName(v string) { + o.Name = &v +} + +func (o Facility) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Facility) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Address) { + toSerialize["address"] = o.Address + } + if !IsNil(o.Code) { + toSerialize["code"] = o.Code + } + if !IsNil(o.Features) { + toSerialize["features"] = o.Features + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.IpRanges) { + toSerialize["ip_ranges"] = o.IpRanges + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Facility) UnmarshalJSON(data []byte) (err error) { + varFacility := _Facility{} + + err = json.Unmarshal(data, &varFacility) + + if err != nil { + return err + } + + *o = Facility(varFacility) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "code") + delete(additionalProperties, "features") + delete(additionalProperties, "id") + delete(additionalProperties, "ip_ranges") + delete(additionalProperties, "metro") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFacility struct { + value *Facility + isSet bool +} + +func (v NullableFacility) Get() *Facility { + return v.value +} + +func (v *NullableFacility) Set(val *Facility) { + v.value = val + v.isSet = true +} + +func (v NullableFacility) IsSet() bool { + return v.isSet +} + +func (v *NullableFacility) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFacility(val *Facility) *NullableFacility { + return &NullableFacility{value: val, isSet: true} +} + +func (v NullableFacility) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFacility) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_features_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_features_inner.go new file mode 100644 index 00000000..e10b9d08 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_features_inner.go @@ -0,0 +1,117 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FacilityFeaturesInner the model 'FacilityFeaturesInner' +type FacilityFeaturesInner string + +// List of Facility_features_inner +const ( + FACILITYFEATURESINNER_BAREMETAL FacilityFeaturesInner = "baremetal" + FACILITYFEATURESINNER_BACKEND_TRANSFER FacilityFeaturesInner = "backend_transfer" + FACILITYFEATURESINNER_LAYER_2 FacilityFeaturesInner = "layer_2" + FACILITYFEATURESINNER_GLOBAL_IPV4 FacilityFeaturesInner = "global_ipv4" + FACILITYFEATURESINNER_IBX FacilityFeaturesInner = "ibx" +) + +// All allowed values of FacilityFeaturesInner enum +var AllowedFacilityFeaturesInnerEnumValues = []FacilityFeaturesInner{ + "baremetal", + "backend_transfer", + "layer_2", + "global_ipv4", + "ibx", +} + +func (v *FacilityFeaturesInner) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FacilityFeaturesInner(value) + for _, existing := range AllowedFacilityFeaturesInnerEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FacilityFeaturesInner", value) +} + +// NewFacilityFeaturesInnerFromValue returns a pointer to a valid FacilityFeaturesInner +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFacilityFeaturesInnerFromValue(v string) (*FacilityFeaturesInner, error) { + ev := FacilityFeaturesInner(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FacilityFeaturesInner: valid values are %v", v, AllowedFacilityFeaturesInnerEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FacilityFeaturesInner) IsValid() bool { + for _, existing := range AllowedFacilityFeaturesInnerEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Facility_features_inner value +func (v FacilityFeaturesInner) Ptr() *FacilityFeaturesInner { + return &v +} + +type NullableFacilityFeaturesInner struct { + value *FacilityFeaturesInner + isSet bool +} + +func (v NullableFacilityFeaturesInner) Get() *FacilityFeaturesInner { + return v.value +} + +func (v *NullableFacilityFeaturesInner) Set(val *FacilityFeaturesInner) { + v.value = val + v.isSet = true +} + +func (v NullableFacilityFeaturesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableFacilityFeaturesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFacilityFeaturesInner(val *FacilityFeaturesInner) *NullableFacilityFeaturesInner { + return &NullableFacilityFeaturesInner{value: val, isSet: true} +} + +func (v NullableFacilityFeaturesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFacilityFeaturesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_input.go new file mode 100644 index 00000000..342e23af --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_input.go @@ -0,0 +1,172 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the FacilityInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FacilityInput{} + +// FacilityInput struct for FacilityInput +type FacilityInput struct { + // The datacenter where the device should be created. Either metro or facility must be provided. The API will accept either a single facility `{ \"facility\": \"f1\" }`, or it can be instructed to create the device in the best available datacenter `{ \"facility\": \"any\" }`. Additionally it is possible to set a prioritized location selection. For example `{ \"facility\": [\"f3\", \"f2\", \"any\"] }` can be used to prioritize `f3` and then `f2` before accepting `any` facility. If none of the facilities provided have availability for the requested device the request will fail. + // Deprecated + Facility []string `json:"facility"` + AdditionalProperties map[string]interface{} +} + +type _FacilityInput FacilityInput + +// NewFacilityInput instantiates a new FacilityInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFacilityInput(facility []string) *FacilityInput { + this := FacilityInput{} + this.Facility = facility + return &this +} + +// NewFacilityInputWithDefaults instantiates a new FacilityInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFacilityInputWithDefaults() *FacilityInput { + this := FacilityInput{} + return &this +} + +// GetFacility returns the Facility field value +// Deprecated +func (o *FacilityInput) GetFacility() []string { + if o == nil { + var ret []string + return ret + } + + return o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *FacilityInput) GetFacilityOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Facility, true +} + +// SetFacility sets field value +// Deprecated +func (o *FacilityInput) SetFacility(v []string) { + o.Facility = v +} + +func (o FacilityInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FacilityInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["facility"] = o.Facility + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FacilityInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "facility", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFacilityInput := _FacilityInput{} + + err = json.Unmarshal(data, &varFacilityInput) + + if err != nil { + return err + } + + *o = FacilityInput(varFacilityInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "facility") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFacilityInput struct { + value *FacilityInput + isSet bool +} + +func (v NullableFacilityInput) Get() *FacilityInput { + return v.value +} + +func (v *NullableFacilityInput) Set(val *FacilityInput) { + v.value = val + v.isSet = true +} + +func (v NullableFacilityInput) IsSet() bool { + return v.isSet +} + +func (v *NullableFacilityInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFacilityInput(val *FacilityInput) *NullableFacilityInput { + return &NullableFacilityInput{value: val, isSet: true} +} + +func (v NullableFacilityInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFacilityInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_list.go new file mode 100644 index 00000000..c0f83822 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_facility_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the FacilityList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FacilityList{} + +// FacilityList struct for FacilityList +type FacilityList struct { + Facilities []Facility `json:"facilities,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _FacilityList FacilityList + +// NewFacilityList instantiates a new FacilityList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFacilityList() *FacilityList { + this := FacilityList{} + return &this +} + +// NewFacilityListWithDefaults instantiates a new FacilityList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFacilityListWithDefaults() *FacilityList { + this := FacilityList{} + return &this +} + +// GetFacilities returns the Facilities field value if set, zero value otherwise. +func (o *FacilityList) GetFacilities() []Facility { + if o == nil || IsNil(o.Facilities) { + var ret []Facility + return ret + } + return o.Facilities +} + +// GetFacilitiesOk returns a tuple with the Facilities field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FacilityList) GetFacilitiesOk() ([]Facility, bool) { + if o == nil || IsNil(o.Facilities) { + return nil, false + } + return o.Facilities, true +} + +// HasFacilities returns a boolean if a field has been set. +func (o *FacilityList) HasFacilities() bool { + if o != nil && !IsNil(o.Facilities) { + return true + } + + return false +} + +// SetFacilities gets a reference to the given []Facility and assigns it to the Facilities field. +func (o *FacilityList) SetFacilities(v []Facility) { + o.Facilities = v +} + +func (o FacilityList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FacilityList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Facilities) { + toSerialize["facilities"] = o.Facilities + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FacilityList) UnmarshalJSON(data []byte) (err error) { + varFacilityList := _FacilityList{} + + err = json.Unmarshal(data, &varFacilityList) + + if err != nil { + return err + } + + *o = FacilityList(varFacilityList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "facilities") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFacilityList struct { + value *FacilityList + isSet bool +} + +func (v NullableFacilityList) Get() *FacilityList { + return v.value +} + +func (v *NullableFacilityList) Set(val *FacilityList) { + v.value = val + v.isSet = true +} + +func (v NullableFacilityList) IsSet() bool { + return v.isSet +} + +func (v *NullableFacilityList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFacilityList(val *FacilityList) *NullableFacilityList { + return &NullableFacilityList{value: val, isSet: true} +} + +func (v NullableFacilityList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFacilityList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_filesystem.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_filesystem.go new file mode 100644 index 00000000..d6faba86 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_filesystem.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Filesystem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Filesystem{} + +// Filesystem struct for Filesystem +type Filesystem struct { + Mount *Mount `json:"mount,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Filesystem Filesystem + +// NewFilesystem instantiates a new Filesystem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFilesystem() *Filesystem { + this := Filesystem{} + return &this +} + +// NewFilesystemWithDefaults instantiates a new Filesystem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFilesystemWithDefaults() *Filesystem { + this := Filesystem{} + return &this +} + +// GetMount returns the Mount field value if set, zero value otherwise. +func (o *Filesystem) GetMount() Mount { + if o == nil || IsNil(o.Mount) { + var ret Mount + return ret + } + return *o.Mount +} + +// GetMountOk returns a tuple with the Mount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Filesystem) GetMountOk() (*Mount, bool) { + if o == nil || IsNil(o.Mount) { + return nil, false + } + return o.Mount, true +} + +// HasMount returns a boolean if a field has been set. +func (o *Filesystem) HasMount() bool { + if o != nil && !IsNil(o.Mount) { + return true + } + + return false +} + +// SetMount gets a reference to the given Mount and assigns it to the Mount field. +func (o *Filesystem) SetMount(v Mount) { + o.Mount = &v +} + +func (o Filesystem) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Filesystem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Mount) { + toSerialize["mount"] = o.Mount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Filesystem) UnmarshalJSON(data []byte) (err error) { + varFilesystem := _Filesystem{} + + err = json.Unmarshal(data, &varFilesystem) + + if err != nil { + return err + } + + *o = Filesystem(varFilesystem) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "mount") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFilesystem struct { + value *Filesystem + isSet bool +} + +func (v NullableFilesystem) Get() *Filesystem { + return v.value +} + +func (v *NullableFilesystem) Set(val *Filesystem) { + v.value = val + v.isSet = true +} + +func (v NullableFilesystem) IsSet() bool { + return v.isSet +} + +func (v *NullableFilesystem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFilesystem(val *Filesystem) *NullableFilesystem { + return &NullableFilesystem{value: val, isSet: true} +} + +func (v NullableFilesystem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFilesystem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_facilities_include_parameter_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_facilities_include_parameter_inner.go new file mode 100644 index 00000000..4f562c65 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_facilities_include_parameter_inner.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindFacilitiesIncludeParameterInner the model 'FindFacilitiesIncludeParameterInner' +type FindFacilitiesIncludeParameterInner string + +// List of findFacilities_include_parameter_inner +const ( + FINDFACILITIESINCLUDEPARAMETERINNER_ADDRESS FindFacilitiesIncludeParameterInner = "address" + FINDFACILITIESINCLUDEPARAMETERINNER_LABELS FindFacilitiesIncludeParameterInner = "labels" +) + +// All allowed values of FindFacilitiesIncludeParameterInner enum +var AllowedFindFacilitiesIncludeParameterInnerEnumValues = []FindFacilitiesIncludeParameterInner{ + "address", + "labels", +} + +func (v *FindFacilitiesIncludeParameterInner) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FindFacilitiesIncludeParameterInner(value) + for _, existing := range AllowedFindFacilitiesIncludeParameterInnerEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FindFacilitiesIncludeParameterInner", value) +} + +// NewFindFacilitiesIncludeParameterInnerFromValue returns a pointer to a valid FindFacilitiesIncludeParameterInner +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFindFacilitiesIncludeParameterInnerFromValue(v string) (*FindFacilitiesIncludeParameterInner, error) { + ev := FindFacilitiesIncludeParameterInner(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FindFacilitiesIncludeParameterInner: valid values are %v", v, AllowedFindFacilitiesIncludeParameterInnerEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FindFacilitiesIncludeParameterInner) IsValid() bool { + for _, existing := range AllowedFindFacilitiesIncludeParameterInnerEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to findFacilities_include_parameter_inner value +func (v FindFacilitiesIncludeParameterInner) Ptr() *FindFacilitiesIncludeParameterInner { + return &v +} + +type NullableFindFacilitiesIncludeParameterInner struct { + value *FindFacilitiesIncludeParameterInner + isSet bool +} + +func (v NullableFindFacilitiesIncludeParameterInner) Get() *FindFacilitiesIncludeParameterInner { + return v.value +} + +func (v *NullableFindFacilitiesIncludeParameterInner) Set(val *FindFacilitiesIncludeParameterInner) { + v.value = val + v.isSet = true +} + +func (v NullableFindFacilitiesIncludeParameterInner) IsSet() bool { + return v.isSet +} + +func (v *NullableFindFacilitiesIncludeParameterInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindFacilitiesIncludeParameterInner(val *FindFacilitiesIncludeParameterInner) *NullableFindFacilitiesIncludeParameterInner { + return &NullableFindFacilitiesIncludeParameterInner{value: val, isSet: true} +} + +func (v NullableFindFacilitiesIncludeParameterInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindFacilitiesIncludeParameterInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_address_by_id_200_response.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_address_by_id_200_response.go new file mode 100644 index 00000000..28f9552c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_address_by_id_200_response.go @@ -0,0 +1,176 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindIPAddressById200Response - struct for FindIPAddressById200Response +type FindIPAddressById200Response struct { + IPAssignment *IPAssignment + IPReservation *IPReservation + VrfIpReservation *VrfIpReservation +} + +// IPAssignmentAsFindIPAddressById200Response is a convenience function that returns IPAssignment wrapped in FindIPAddressById200Response +func IPAssignmentAsFindIPAddressById200Response(v *IPAssignment) FindIPAddressById200Response { + return FindIPAddressById200Response{ + IPAssignment: v, + } +} + +// IPReservationAsFindIPAddressById200Response is a convenience function that returns IPReservation wrapped in FindIPAddressById200Response +func IPReservationAsFindIPAddressById200Response(v *IPReservation) FindIPAddressById200Response { + return FindIPAddressById200Response{ + IPReservation: v, + } +} + +// VrfIpReservationAsFindIPAddressById200Response is a convenience function that returns VrfIpReservation wrapped in FindIPAddressById200Response +func VrfIpReservationAsFindIPAddressById200Response(v *VrfIpReservation) FindIPAddressById200Response { + return FindIPAddressById200Response{ + VrfIpReservation: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *FindIPAddressById200Response) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into IPAssignment + err = newStrictDecoder(data).Decode(&dst.IPAssignment) + if err == nil { + jsonIPAssignment, _ := json.Marshal(dst.IPAssignment) + if string(jsonIPAssignment) == "{}" { // empty struct + dst.IPAssignment = nil + } else { + match++ + } + } else { + dst.IPAssignment = nil + } + + // try to unmarshal data into IPReservation + err = newStrictDecoder(data).Decode(&dst.IPReservation) + if err == nil { + jsonIPReservation, _ := json.Marshal(dst.IPReservation) + if string(jsonIPReservation) == "{}" { // empty struct + dst.IPReservation = nil + } else { + match++ + } + } else { + dst.IPReservation = nil + } + + // try to unmarshal data into VrfIpReservation + err = newStrictDecoder(data).Decode(&dst.VrfIpReservation) + if err == nil { + jsonVrfIpReservation, _ := json.Marshal(dst.VrfIpReservation) + if string(jsonVrfIpReservation) == "{}" { // empty struct + dst.VrfIpReservation = nil + } else { + match++ + } + } else { + dst.VrfIpReservation = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.IPAssignment = nil + dst.IPReservation = nil + dst.VrfIpReservation = nil + + return fmt.Errorf("data matches more than one schema in oneOf(FindIPAddressById200Response)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(FindIPAddressById200Response)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src FindIPAddressById200Response) MarshalJSON() ([]byte, error) { + if src.IPAssignment != nil { + return json.Marshal(&src.IPAssignment) + } + + if src.IPReservation != nil { + return json.Marshal(&src.IPReservation) + } + + if src.VrfIpReservation != nil { + return json.Marshal(&src.VrfIpReservation) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *FindIPAddressById200Response) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.IPAssignment != nil { + return obj.IPAssignment + } + + if obj.IPReservation != nil { + return obj.IPReservation + } + + if obj.VrfIpReservation != nil { + return obj.VrfIpReservation + } + + // all schemas are nil + return nil +} + +type NullableFindIPAddressById200Response struct { + value *FindIPAddressById200Response + isSet bool +} + +func (v NullableFindIPAddressById200Response) Get() *FindIPAddressById200Response { + return v.value +} + +func (v *NullableFindIPAddressById200Response) Set(val *FindIPAddressById200Response) { + v.value = val + v.isSet = true +} + +func (v NullableFindIPAddressById200Response) IsSet() bool { + return v.isSet +} + +func (v *NullableFindIPAddressById200Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindIPAddressById200Response(val *FindIPAddressById200Response) *NullableFindIPAddressById200Response { + return &NullableFindIPAddressById200Response{value: val, isSet: true} +} + +func (v NullableFindIPAddressById200Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindIPAddressById200Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_availabilities_cidr_parameter.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_availabilities_cidr_parameter.go new file mode 100644 index 00000000..c8b7eab2 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_availabilities_cidr_parameter.go @@ -0,0 +1,325 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindIPAvailabilitiesCidrParameter the model 'FindIPAvailabilitiesCidrParameter' +type FindIPAvailabilitiesCidrParameter string + +// List of findIPAvailabilities_cidr_parameter +const ( + FINDIPAVAILABILITIESCIDRPARAMETER__20 FindIPAvailabilitiesCidrParameter = "20" + FINDIPAVAILABILITIESCIDRPARAMETER__21 FindIPAvailabilitiesCidrParameter = "21" + FINDIPAVAILABILITIESCIDRPARAMETER__22 FindIPAvailabilitiesCidrParameter = "22" + FINDIPAVAILABILITIESCIDRPARAMETER__23 FindIPAvailabilitiesCidrParameter = "23" + FINDIPAVAILABILITIESCIDRPARAMETER__24 FindIPAvailabilitiesCidrParameter = "24" + FINDIPAVAILABILITIESCIDRPARAMETER__25 FindIPAvailabilitiesCidrParameter = "25" + FINDIPAVAILABILITIESCIDRPARAMETER__26 FindIPAvailabilitiesCidrParameter = "26" + FINDIPAVAILABILITIESCIDRPARAMETER__27 FindIPAvailabilitiesCidrParameter = "27" + FINDIPAVAILABILITIESCIDRPARAMETER__28 FindIPAvailabilitiesCidrParameter = "28" + FINDIPAVAILABILITIESCIDRPARAMETER__29 FindIPAvailabilitiesCidrParameter = "29" + FINDIPAVAILABILITIESCIDRPARAMETER__30 FindIPAvailabilitiesCidrParameter = "30" + FINDIPAVAILABILITIESCIDRPARAMETER__31 FindIPAvailabilitiesCidrParameter = "31" + FINDIPAVAILABILITIESCIDRPARAMETER__32 FindIPAvailabilitiesCidrParameter = "32" + FINDIPAVAILABILITIESCIDRPARAMETER__33 FindIPAvailabilitiesCidrParameter = "33" + FINDIPAVAILABILITIESCIDRPARAMETER__34 FindIPAvailabilitiesCidrParameter = "34" + FINDIPAVAILABILITIESCIDRPARAMETER__35 FindIPAvailabilitiesCidrParameter = "35" + FINDIPAVAILABILITIESCIDRPARAMETER__36 FindIPAvailabilitiesCidrParameter = "36" + FINDIPAVAILABILITIESCIDRPARAMETER__37 FindIPAvailabilitiesCidrParameter = "37" + FINDIPAVAILABILITIESCIDRPARAMETER__38 FindIPAvailabilitiesCidrParameter = "38" + FINDIPAVAILABILITIESCIDRPARAMETER__39 FindIPAvailabilitiesCidrParameter = "39" + FINDIPAVAILABILITIESCIDRPARAMETER__40 FindIPAvailabilitiesCidrParameter = "40" + FINDIPAVAILABILITIESCIDRPARAMETER__41 FindIPAvailabilitiesCidrParameter = "41" + FINDIPAVAILABILITIESCIDRPARAMETER__42 FindIPAvailabilitiesCidrParameter = "42" + FINDIPAVAILABILITIESCIDRPARAMETER__43 FindIPAvailabilitiesCidrParameter = "43" + FINDIPAVAILABILITIESCIDRPARAMETER__44 FindIPAvailabilitiesCidrParameter = "44" + FINDIPAVAILABILITIESCIDRPARAMETER__45 FindIPAvailabilitiesCidrParameter = "45" + FINDIPAVAILABILITIESCIDRPARAMETER__46 FindIPAvailabilitiesCidrParameter = "46" + FINDIPAVAILABILITIESCIDRPARAMETER__47 FindIPAvailabilitiesCidrParameter = "47" + FINDIPAVAILABILITIESCIDRPARAMETER__48 FindIPAvailabilitiesCidrParameter = "48" + FINDIPAVAILABILITIESCIDRPARAMETER__49 FindIPAvailabilitiesCidrParameter = "49" + FINDIPAVAILABILITIESCIDRPARAMETER__50 FindIPAvailabilitiesCidrParameter = "50" + FINDIPAVAILABILITIESCIDRPARAMETER__51 FindIPAvailabilitiesCidrParameter = "51" + FINDIPAVAILABILITIESCIDRPARAMETER__52 FindIPAvailabilitiesCidrParameter = "52" + FINDIPAVAILABILITIESCIDRPARAMETER__53 FindIPAvailabilitiesCidrParameter = "53" + FINDIPAVAILABILITIESCIDRPARAMETER__54 FindIPAvailabilitiesCidrParameter = "54" + FINDIPAVAILABILITIESCIDRPARAMETER__55 FindIPAvailabilitiesCidrParameter = "55" + FINDIPAVAILABILITIESCIDRPARAMETER__56 FindIPAvailabilitiesCidrParameter = "56" + FINDIPAVAILABILITIESCIDRPARAMETER__57 FindIPAvailabilitiesCidrParameter = "57" + FINDIPAVAILABILITIESCIDRPARAMETER__58 FindIPAvailabilitiesCidrParameter = "58" + FINDIPAVAILABILITIESCIDRPARAMETER__59 FindIPAvailabilitiesCidrParameter = "59" + FINDIPAVAILABILITIESCIDRPARAMETER__60 FindIPAvailabilitiesCidrParameter = "60" + FINDIPAVAILABILITIESCIDRPARAMETER__61 FindIPAvailabilitiesCidrParameter = "61" + FINDIPAVAILABILITIESCIDRPARAMETER__62 FindIPAvailabilitiesCidrParameter = "62" + FINDIPAVAILABILITIESCIDRPARAMETER__63 FindIPAvailabilitiesCidrParameter = "63" + FINDIPAVAILABILITIESCIDRPARAMETER__64 FindIPAvailabilitiesCidrParameter = "64" + FINDIPAVAILABILITIESCIDRPARAMETER__65 FindIPAvailabilitiesCidrParameter = "65" + FINDIPAVAILABILITIESCIDRPARAMETER__66 FindIPAvailabilitiesCidrParameter = "66" + FINDIPAVAILABILITIESCIDRPARAMETER__67 FindIPAvailabilitiesCidrParameter = "67" + FINDIPAVAILABILITIESCIDRPARAMETER__68 FindIPAvailabilitiesCidrParameter = "68" + FINDIPAVAILABILITIESCIDRPARAMETER__69 FindIPAvailabilitiesCidrParameter = "69" + FINDIPAVAILABILITIESCIDRPARAMETER__70 FindIPAvailabilitiesCidrParameter = "70" + FINDIPAVAILABILITIESCIDRPARAMETER__71 FindIPAvailabilitiesCidrParameter = "71" + FINDIPAVAILABILITIESCIDRPARAMETER__72 FindIPAvailabilitiesCidrParameter = "72" + FINDIPAVAILABILITIESCIDRPARAMETER__73 FindIPAvailabilitiesCidrParameter = "73" + FINDIPAVAILABILITIESCIDRPARAMETER__74 FindIPAvailabilitiesCidrParameter = "74" + FINDIPAVAILABILITIESCIDRPARAMETER__75 FindIPAvailabilitiesCidrParameter = "75" + FINDIPAVAILABILITIESCIDRPARAMETER__76 FindIPAvailabilitiesCidrParameter = "76" + FINDIPAVAILABILITIESCIDRPARAMETER__77 FindIPAvailabilitiesCidrParameter = "77" + FINDIPAVAILABILITIESCIDRPARAMETER__78 FindIPAvailabilitiesCidrParameter = "78" + FINDIPAVAILABILITIESCIDRPARAMETER__79 FindIPAvailabilitiesCidrParameter = "79" + FINDIPAVAILABILITIESCIDRPARAMETER__80 FindIPAvailabilitiesCidrParameter = "80" + FINDIPAVAILABILITIESCIDRPARAMETER__81 FindIPAvailabilitiesCidrParameter = "81" + FINDIPAVAILABILITIESCIDRPARAMETER__82 FindIPAvailabilitiesCidrParameter = "82" + FINDIPAVAILABILITIESCIDRPARAMETER__83 FindIPAvailabilitiesCidrParameter = "83" + FINDIPAVAILABILITIESCIDRPARAMETER__84 FindIPAvailabilitiesCidrParameter = "84" + FINDIPAVAILABILITIESCIDRPARAMETER__85 FindIPAvailabilitiesCidrParameter = "85" + FINDIPAVAILABILITIESCIDRPARAMETER__86 FindIPAvailabilitiesCidrParameter = "86" + FINDIPAVAILABILITIESCIDRPARAMETER__87 FindIPAvailabilitiesCidrParameter = "87" + FINDIPAVAILABILITIESCIDRPARAMETER__88 FindIPAvailabilitiesCidrParameter = "88" + FINDIPAVAILABILITIESCIDRPARAMETER__89 FindIPAvailabilitiesCidrParameter = "89" + FINDIPAVAILABILITIESCIDRPARAMETER__90 FindIPAvailabilitiesCidrParameter = "90" + FINDIPAVAILABILITIESCIDRPARAMETER__91 FindIPAvailabilitiesCidrParameter = "91" + FINDIPAVAILABILITIESCIDRPARAMETER__92 FindIPAvailabilitiesCidrParameter = "92" + FINDIPAVAILABILITIESCIDRPARAMETER__93 FindIPAvailabilitiesCidrParameter = "93" + FINDIPAVAILABILITIESCIDRPARAMETER__94 FindIPAvailabilitiesCidrParameter = "94" + FINDIPAVAILABILITIESCIDRPARAMETER__95 FindIPAvailabilitiesCidrParameter = "95" + FINDIPAVAILABILITIESCIDRPARAMETER__96 FindIPAvailabilitiesCidrParameter = "96" + FINDIPAVAILABILITIESCIDRPARAMETER__97 FindIPAvailabilitiesCidrParameter = "97" + FINDIPAVAILABILITIESCIDRPARAMETER__98 FindIPAvailabilitiesCidrParameter = "98" + FINDIPAVAILABILITIESCIDRPARAMETER__99 FindIPAvailabilitiesCidrParameter = "99" + FINDIPAVAILABILITIESCIDRPARAMETER__100 FindIPAvailabilitiesCidrParameter = "100" + FINDIPAVAILABILITIESCIDRPARAMETER__101 FindIPAvailabilitiesCidrParameter = "101" + FINDIPAVAILABILITIESCIDRPARAMETER__102 FindIPAvailabilitiesCidrParameter = "102" + FINDIPAVAILABILITIESCIDRPARAMETER__103 FindIPAvailabilitiesCidrParameter = "103" + FINDIPAVAILABILITIESCIDRPARAMETER__104 FindIPAvailabilitiesCidrParameter = "104" + FINDIPAVAILABILITIESCIDRPARAMETER__105 FindIPAvailabilitiesCidrParameter = "105" + FINDIPAVAILABILITIESCIDRPARAMETER__106 FindIPAvailabilitiesCidrParameter = "106" + FINDIPAVAILABILITIESCIDRPARAMETER__107 FindIPAvailabilitiesCidrParameter = "107" + FINDIPAVAILABILITIESCIDRPARAMETER__108 FindIPAvailabilitiesCidrParameter = "108" + FINDIPAVAILABILITIESCIDRPARAMETER__109 FindIPAvailabilitiesCidrParameter = "109" + FINDIPAVAILABILITIESCIDRPARAMETER__110 FindIPAvailabilitiesCidrParameter = "110" + FINDIPAVAILABILITIESCIDRPARAMETER__111 FindIPAvailabilitiesCidrParameter = "111" + FINDIPAVAILABILITIESCIDRPARAMETER__112 FindIPAvailabilitiesCidrParameter = "112" + FINDIPAVAILABILITIESCIDRPARAMETER__113 FindIPAvailabilitiesCidrParameter = "113" + FINDIPAVAILABILITIESCIDRPARAMETER__114 FindIPAvailabilitiesCidrParameter = "114" + FINDIPAVAILABILITIESCIDRPARAMETER__115 FindIPAvailabilitiesCidrParameter = "115" + FINDIPAVAILABILITIESCIDRPARAMETER__116 FindIPAvailabilitiesCidrParameter = "116" + FINDIPAVAILABILITIESCIDRPARAMETER__117 FindIPAvailabilitiesCidrParameter = "117" + FINDIPAVAILABILITIESCIDRPARAMETER__118 FindIPAvailabilitiesCidrParameter = "118" + FINDIPAVAILABILITIESCIDRPARAMETER__119 FindIPAvailabilitiesCidrParameter = "119" + FINDIPAVAILABILITIESCIDRPARAMETER__120 FindIPAvailabilitiesCidrParameter = "120" + FINDIPAVAILABILITIESCIDRPARAMETER__121 FindIPAvailabilitiesCidrParameter = "121" + FINDIPAVAILABILITIESCIDRPARAMETER__122 FindIPAvailabilitiesCidrParameter = "122" + FINDIPAVAILABILITIESCIDRPARAMETER__123 FindIPAvailabilitiesCidrParameter = "123" + FINDIPAVAILABILITIESCIDRPARAMETER__124 FindIPAvailabilitiesCidrParameter = "124" + FINDIPAVAILABILITIESCIDRPARAMETER__125 FindIPAvailabilitiesCidrParameter = "125" + FINDIPAVAILABILITIESCIDRPARAMETER__126 FindIPAvailabilitiesCidrParameter = "126" + FINDIPAVAILABILITIESCIDRPARAMETER__127 FindIPAvailabilitiesCidrParameter = "127" + FINDIPAVAILABILITIESCIDRPARAMETER__128 FindIPAvailabilitiesCidrParameter = "128" +) + +// All allowed values of FindIPAvailabilitiesCidrParameter enum +var AllowedFindIPAvailabilitiesCidrParameterEnumValues = []FindIPAvailabilitiesCidrParameter{ + "20", + "21", + "22", + "23", + "24", + "25", + "26", + "27", + "28", + "29", + "30", + "31", + "32", + "33", + "34", + "35", + "36", + "37", + "38", + "39", + "40", + "41", + "42", + "43", + "44", + "45", + "46", + "47", + "48", + "49", + "50", + "51", + "52", + "53", + "54", + "55", + "56", + "57", + "58", + "59", + "60", + "61", + "62", + "63", + "64", + "65", + "66", + "67", + "68", + "69", + "70", + "71", + "72", + "73", + "74", + "75", + "76", + "77", + "78", + "79", + "80", + "81", + "82", + "83", + "84", + "85", + "86", + "87", + "88", + "89", + "90", + "91", + "92", + "93", + "94", + "95", + "96", + "97", + "98", + "99", + "100", + "101", + "102", + "103", + "104", + "105", + "106", + "107", + "108", + "109", + "110", + "111", + "112", + "113", + "114", + "115", + "116", + "117", + "118", + "119", + "120", + "121", + "122", + "123", + "124", + "125", + "126", + "127", + "128", +} + +func (v *FindIPAvailabilitiesCidrParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FindIPAvailabilitiesCidrParameter(value) + for _, existing := range AllowedFindIPAvailabilitiesCidrParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FindIPAvailabilitiesCidrParameter", value) +} + +// NewFindIPAvailabilitiesCidrParameterFromValue returns a pointer to a valid FindIPAvailabilitiesCidrParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFindIPAvailabilitiesCidrParameterFromValue(v string) (*FindIPAvailabilitiesCidrParameter, error) { + ev := FindIPAvailabilitiesCidrParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FindIPAvailabilitiesCidrParameter: valid values are %v", v, AllowedFindIPAvailabilitiesCidrParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FindIPAvailabilitiesCidrParameter) IsValid() bool { + for _, existing := range AllowedFindIPAvailabilitiesCidrParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to findIPAvailabilities_cidr_parameter value +func (v FindIPAvailabilitiesCidrParameter) Ptr() *FindIPAvailabilitiesCidrParameter { + return &v +} + +type NullableFindIPAvailabilitiesCidrParameter struct { + value *FindIPAvailabilitiesCidrParameter + isSet bool +} + +func (v NullableFindIPAvailabilitiesCidrParameter) Get() *FindIPAvailabilitiesCidrParameter { + return v.value +} + +func (v *NullableFindIPAvailabilitiesCidrParameter) Set(val *FindIPAvailabilitiesCidrParameter) { + v.value = val + v.isSet = true +} + +func (v NullableFindIPAvailabilitiesCidrParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableFindIPAvailabilitiesCidrParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindIPAvailabilitiesCidrParameter(val *FindIPAvailabilitiesCidrParameter) *NullableFindIPAvailabilitiesCidrParameter { + return &NullableFindIPAvailabilitiesCidrParameter{value: val, isSet: true} +} + +func (v NullableFindIPAvailabilitiesCidrParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindIPAvailabilitiesCidrParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_reservations_types_parameter_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_reservations_types_parameter_inner.go new file mode 100644 index 00000000..bdc3d40b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_ip_reservations_types_parameter_inner.go @@ -0,0 +1,117 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindIPReservationsTypesParameterInner the model 'FindIPReservationsTypesParameterInner' +type FindIPReservationsTypesParameterInner string + +// List of findIPReservations_types_parameter_inner +const ( + FINDIPRESERVATIONSTYPESPARAMETERINNER_GLOBAL_IPV4 FindIPReservationsTypesParameterInner = "global_ipv4" + FINDIPRESERVATIONSTYPESPARAMETERINNER_PRIVATE_IPV4 FindIPReservationsTypesParameterInner = "private_ipv4" + FINDIPRESERVATIONSTYPESPARAMETERINNER_PUBLIC_IPV4 FindIPReservationsTypesParameterInner = "public_ipv4" + FINDIPRESERVATIONSTYPESPARAMETERINNER_PUBLIC_IPV6 FindIPReservationsTypesParameterInner = "public_ipv6" + FINDIPRESERVATIONSTYPESPARAMETERINNER_VRF FindIPReservationsTypesParameterInner = "vrf" +) + +// All allowed values of FindIPReservationsTypesParameterInner enum +var AllowedFindIPReservationsTypesParameterInnerEnumValues = []FindIPReservationsTypesParameterInner{ + "global_ipv4", + "private_ipv4", + "public_ipv4", + "public_ipv6", + "vrf", +} + +func (v *FindIPReservationsTypesParameterInner) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FindIPReservationsTypesParameterInner(value) + for _, existing := range AllowedFindIPReservationsTypesParameterInnerEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FindIPReservationsTypesParameterInner", value) +} + +// NewFindIPReservationsTypesParameterInnerFromValue returns a pointer to a valid FindIPReservationsTypesParameterInner +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFindIPReservationsTypesParameterInnerFromValue(v string) (*FindIPReservationsTypesParameterInner, error) { + ev := FindIPReservationsTypesParameterInner(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FindIPReservationsTypesParameterInner: valid values are %v", v, AllowedFindIPReservationsTypesParameterInnerEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FindIPReservationsTypesParameterInner) IsValid() bool { + for _, existing := range AllowedFindIPReservationsTypesParameterInnerEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to findIPReservations_types_parameter_inner value +func (v FindIPReservationsTypesParameterInner) Ptr() *FindIPReservationsTypesParameterInner { + return &v +} + +type NullableFindIPReservationsTypesParameterInner struct { + value *FindIPReservationsTypesParameterInner + isSet bool +} + +func (v NullableFindIPReservationsTypesParameterInner) Get() *FindIPReservationsTypesParameterInner { + return v.value +} + +func (v *NullableFindIPReservationsTypesParameterInner) Set(val *FindIPReservationsTypesParameterInner) { + v.value = val + v.isSet = true +} + +func (v NullableFindIPReservationsTypesParameterInner) IsSet() bool { + return v.isSet +} + +func (v *NullableFindIPReservationsTypesParameterInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindIPReservationsTypesParameterInner(val *FindIPReservationsTypesParameterInner) *NullableFindIPReservationsTypesParameterInner { + return &NullableFindIPReservationsTypesParameterInner{value: val, isSet: true} +} + +func (v NullableFindIPReservationsTypesParameterInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindIPReservationsTypesParameterInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_metal_gateway_by_id_200_response.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_metal_gateway_by_id_200_response.go new file mode 100644 index 00000000..3300b1f2 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_metal_gateway_by_id_200_response.go @@ -0,0 +1,146 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindMetalGatewayById200Response - struct for FindMetalGatewayById200Response +type FindMetalGatewayById200Response struct { + MetalGateway *MetalGateway + VrfMetalGateway *VrfMetalGateway +} + +// MetalGatewayAsFindMetalGatewayById200Response is a convenience function that returns MetalGateway wrapped in FindMetalGatewayById200Response +func MetalGatewayAsFindMetalGatewayById200Response(v *MetalGateway) FindMetalGatewayById200Response { + return FindMetalGatewayById200Response{ + MetalGateway: v, + } +} + +// VrfMetalGatewayAsFindMetalGatewayById200Response is a convenience function that returns VrfMetalGateway wrapped in FindMetalGatewayById200Response +func VrfMetalGatewayAsFindMetalGatewayById200Response(v *VrfMetalGateway) FindMetalGatewayById200Response { + return FindMetalGatewayById200Response{ + VrfMetalGateway: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *FindMetalGatewayById200Response) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into MetalGateway + err = newStrictDecoder(data).Decode(&dst.MetalGateway) + if err == nil { + jsonMetalGateway, _ := json.Marshal(dst.MetalGateway) + if string(jsonMetalGateway) == "{}" { // empty struct + dst.MetalGateway = nil + } else { + match++ + } + } else { + dst.MetalGateway = nil + } + + // try to unmarshal data into VrfMetalGateway + err = newStrictDecoder(data).Decode(&dst.VrfMetalGateway) + if err == nil { + jsonVrfMetalGateway, _ := json.Marshal(dst.VrfMetalGateway) + if string(jsonVrfMetalGateway) == "{}" { // empty struct + dst.VrfMetalGateway = nil + } else { + match++ + } + } else { + dst.VrfMetalGateway = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.MetalGateway = nil + dst.VrfMetalGateway = nil + + return fmt.Errorf("data matches more than one schema in oneOf(FindMetalGatewayById200Response)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(FindMetalGatewayById200Response)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src FindMetalGatewayById200Response) MarshalJSON() ([]byte, error) { + if src.MetalGateway != nil { + return json.Marshal(&src.MetalGateway) + } + + if src.VrfMetalGateway != nil { + return json.Marshal(&src.VrfMetalGateway) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *FindMetalGatewayById200Response) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.MetalGateway != nil { + return obj.MetalGateway + } + + if obj.VrfMetalGateway != nil { + return obj.VrfMetalGateway + } + + // all schemas are nil + return nil +} + +type NullableFindMetalGatewayById200Response struct { + value *FindMetalGatewayById200Response + isSet bool +} + +func (v NullableFindMetalGatewayById200Response) Get() *FindMetalGatewayById200Response { + return v.value +} + +func (v *NullableFindMetalGatewayById200Response) Set(val *FindMetalGatewayById200Response) { + v.value = val + v.isSet = true +} + +func (v NullableFindMetalGatewayById200Response) IsSet() bool { + return v.isSet +} + +func (v *NullableFindMetalGatewayById200Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindMetalGatewayById200Response(val *FindMetalGatewayById200Response) *NullableFindMetalGatewayById200Response { + return &NullableFindMetalGatewayById200Response{value: val, isSet: true} +} + +func (v NullableFindMetalGatewayById200Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindMetalGatewayById200Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_organization_devices_categories_parameter_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_organization_devices_categories_parameter_inner.go new file mode 100644 index 00000000..fc2a1472 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_organization_devices_categories_parameter_inner.go @@ -0,0 +1,117 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindOrganizationDevicesCategoriesParameterInner the model 'FindOrganizationDevicesCategoriesParameterInner' +type FindOrganizationDevicesCategoriesParameterInner string + +// List of findOrganizationDevices_categories_parameter_inner +const ( + FINDORGANIZATIONDEVICESCATEGORIESPARAMETERINNER_COMPUTE FindOrganizationDevicesCategoriesParameterInner = "compute" + FINDORGANIZATIONDEVICESCATEGORIESPARAMETERINNER_STORAGE FindOrganizationDevicesCategoriesParameterInner = "storage" + FINDORGANIZATIONDEVICESCATEGORIESPARAMETERINNER_VMCE FindOrganizationDevicesCategoriesParameterInner = "vmce" + FINDORGANIZATIONDEVICESCATEGORIESPARAMETERINNER_LEGACY_GEN FindOrganizationDevicesCategoriesParameterInner = "legacy_gen" + FINDORGANIZATIONDEVICESCATEGORIESPARAMETERINNER_CURRENT_GEN FindOrganizationDevicesCategoriesParameterInner = "current_gen" +) + +// All allowed values of FindOrganizationDevicesCategoriesParameterInner enum +var AllowedFindOrganizationDevicesCategoriesParameterInnerEnumValues = []FindOrganizationDevicesCategoriesParameterInner{ + "compute", + "storage", + "vmce", + "legacy_gen", + "current_gen", +} + +func (v *FindOrganizationDevicesCategoriesParameterInner) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FindOrganizationDevicesCategoriesParameterInner(value) + for _, existing := range AllowedFindOrganizationDevicesCategoriesParameterInnerEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FindOrganizationDevicesCategoriesParameterInner", value) +} + +// NewFindOrganizationDevicesCategoriesParameterInnerFromValue returns a pointer to a valid FindOrganizationDevicesCategoriesParameterInner +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFindOrganizationDevicesCategoriesParameterInnerFromValue(v string) (*FindOrganizationDevicesCategoriesParameterInner, error) { + ev := FindOrganizationDevicesCategoriesParameterInner(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FindOrganizationDevicesCategoriesParameterInner: valid values are %v", v, AllowedFindOrganizationDevicesCategoriesParameterInnerEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FindOrganizationDevicesCategoriesParameterInner) IsValid() bool { + for _, existing := range AllowedFindOrganizationDevicesCategoriesParameterInnerEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to findOrganizationDevices_categories_parameter_inner value +func (v FindOrganizationDevicesCategoriesParameterInner) Ptr() *FindOrganizationDevicesCategoriesParameterInner { + return &v +} + +type NullableFindOrganizationDevicesCategoriesParameterInner struct { + value *FindOrganizationDevicesCategoriesParameterInner + isSet bool +} + +func (v NullableFindOrganizationDevicesCategoriesParameterInner) Get() *FindOrganizationDevicesCategoriesParameterInner { + return v.value +} + +func (v *NullableFindOrganizationDevicesCategoriesParameterInner) Set(val *FindOrganizationDevicesCategoriesParameterInner) { + v.value = val + v.isSet = true +} + +func (v NullableFindOrganizationDevicesCategoriesParameterInner) IsSet() bool { + return v.isSet +} + +func (v *NullableFindOrganizationDevicesCategoriesParameterInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindOrganizationDevicesCategoriesParameterInner(val *FindOrganizationDevicesCategoriesParameterInner) *NullableFindOrganizationDevicesCategoriesParameterInner { + return &NullableFindOrganizationDevicesCategoriesParameterInner{value: val, isSet: true} +} + +func (v NullableFindOrganizationDevicesCategoriesParameterInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindOrganizationDevicesCategoriesParameterInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_organizations_personal_parameter.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_organizations_personal_parameter.go new file mode 100644 index 00000000..39a4a3fe --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_organizations_personal_parameter.go @@ -0,0 +1,113 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindOrganizationsPersonalParameter the model 'FindOrganizationsPersonalParameter' +type FindOrganizationsPersonalParameter string + +// List of findOrganizations_personal_parameter +const ( + FINDORGANIZATIONSPERSONALPARAMETER_INCLUDE FindOrganizationsPersonalParameter = "include" + FINDORGANIZATIONSPERSONALPARAMETER_EXCLUDE FindOrganizationsPersonalParameter = "exclude" + FINDORGANIZATIONSPERSONALPARAMETER_ONLY FindOrganizationsPersonalParameter = "only" +) + +// All allowed values of FindOrganizationsPersonalParameter enum +var AllowedFindOrganizationsPersonalParameterEnumValues = []FindOrganizationsPersonalParameter{ + "include", + "exclude", + "only", +} + +func (v *FindOrganizationsPersonalParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FindOrganizationsPersonalParameter(value) + for _, existing := range AllowedFindOrganizationsPersonalParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FindOrganizationsPersonalParameter", value) +} + +// NewFindOrganizationsPersonalParameterFromValue returns a pointer to a valid FindOrganizationsPersonalParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFindOrganizationsPersonalParameterFromValue(v string) (*FindOrganizationsPersonalParameter, error) { + ev := FindOrganizationsPersonalParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FindOrganizationsPersonalParameter: valid values are %v", v, AllowedFindOrganizationsPersonalParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FindOrganizationsPersonalParameter) IsValid() bool { + for _, existing := range AllowedFindOrganizationsPersonalParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to findOrganizations_personal_parameter value +func (v FindOrganizationsPersonalParameter) Ptr() *FindOrganizationsPersonalParameter { + return &v +} + +type NullableFindOrganizationsPersonalParameter struct { + value *FindOrganizationsPersonalParameter + isSet bool +} + +func (v NullableFindOrganizationsPersonalParameter) Get() *FindOrganizationsPersonalParameter { + return v.value +} + +func (v *NullableFindOrganizationsPersonalParameter) Set(val *FindOrganizationsPersonalParameter) { + v.value = val + v.isSet = true +} + +func (v NullableFindOrganizationsPersonalParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableFindOrganizationsPersonalParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindOrganizationsPersonalParameter(val *FindOrganizationsPersonalParameter) *NullableFindOrganizationsPersonalParameter { + return &NullableFindOrganizationsPersonalParameter{value: val, isSet: true} +} + +func (v NullableFindOrganizationsPersonalParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindOrganizationsPersonalParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_plans_type_parameter.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_plans_type_parameter.go new file mode 100644 index 00000000..c97f6e8c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_plans_type_parameter.go @@ -0,0 +1,113 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindPlansTypeParameter the model 'FindPlansTypeParameter' +type FindPlansTypeParameter string + +// List of findPlans_type_parameter +const ( + FINDPLANSTYPEPARAMETER_STANDARD FindPlansTypeParameter = "standard" + FINDPLANSTYPEPARAMETER_WORKLOAD_OPTIMIZED FindPlansTypeParameter = "workload_optimized" + FINDPLANSTYPEPARAMETER_CUSTOM FindPlansTypeParameter = "custom" +) + +// All allowed values of FindPlansTypeParameter enum +var AllowedFindPlansTypeParameterEnumValues = []FindPlansTypeParameter{ + "standard", + "workload_optimized", + "custom", +} + +func (v *FindPlansTypeParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FindPlansTypeParameter(value) + for _, existing := range AllowedFindPlansTypeParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FindPlansTypeParameter", value) +} + +// NewFindPlansTypeParameterFromValue returns a pointer to a valid FindPlansTypeParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFindPlansTypeParameterFromValue(v string) (*FindPlansTypeParameter, error) { + ev := FindPlansTypeParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FindPlansTypeParameter: valid values are %v", v, AllowedFindPlansTypeParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FindPlansTypeParameter) IsValid() bool { + for _, existing := range AllowedFindPlansTypeParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to findPlans_type_parameter value +func (v FindPlansTypeParameter) Ptr() *FindPlansTypeParameter { + return &v +} + +type NullableFindPlansTypeParameter struct { + value *FindPlansTypeParameter + isSet bool +} + +func (v NullableFindPlansTypeParameter) Get() *FindPlansTypeParameter { + return v.value +} + +func (v *NullableFindPlansTypeParameter) Set(val *FindPlansTypeParameter) { + v.value = val + v.isSet = true +} + +func (v NullableFindPlansTypeParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableFindPlansTypeParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindPlansTypeParameter(val *FindPlansTypeParameter) *NullableFindPlansTypeParameter { + return &NullableFindPlansTypeParameter{value: val, isSet: true} +} + +func (v NullableFindPlansTypeParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindPlansTypeParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_project_hardware_reservations_provisionable_parameter.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_project_hardware_reservations_provisionable_parameter.go new file mode 100644 index 00000000..f1c1fd25 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_project_hardware_reservations_provisionable_parameter.go @@ -0,0 +1,109 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindProjectHardwareReservationsProvisionableParameter the model 'FindProjectHardwareReservationsProvisionableParameter' +type FindProjectHardwareReservationsProvisionableParameter string + +// List of findProjectHardwareReservations_provisionable_parameter +const ( + FINDPROJECTHARDWARERESERVATIONSPROVISIONABLEPARAMETER_ONLY FindProjectHardwareReservationsProvisionableParameter = "only" +) + +// All allowed values of FindProjectHardwareReservationsProvisionableParameter enum +var AllowedFindProjectHardwareReservationsProvisionableParameterEnumValues = []FindProjectHardwareReservationsProvisionableParameter{ + "only", +} + +func (v *FindProjectHardwareReservationsProvisionableParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FindProjectHardwareReservationsProvisionableParameter(value) + for _, existing := range AllowedFindProjectHardwareReservationsProvisionableParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FindProjectHardwareReservationsProvisionableParameter", value) +} + +// NewFindProjectHardwareReservationsProvisionableParameterFromValue returns a pointer to a valid FindProjectHardwareReservationsProvisionableParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFindProjectHardwareReservationsProvisionableParameterFromValue(v string) (*FindProjectHardwareReservationsProvisionableParameter, error) { + ev := FindProjectHardwareReservationsProvisionableParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FindProjectHardwareReservationsProvisionableParameter: valid values are %v", v, AllowedFindProjectHardwareReservationsProvisionableParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FindProjectHardwareReservationsProvisionableParameter) IsValid() bool { + for _, existing := range AllowedFindProjectHardwareReservationsProvisionableParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to findProjectHardwareReservations_provisionable_parameter value +func (v FindProjectHardwareReservationsProvisionableParameter) Ptr() *FindProjectHardwareReservationsProvisionableParameter { + return &v +} + +type NullableFindProjectHardwareReservationsProvisionableParameter struct { + value *FindProjectHardwareReservationsProvisionableParameter + isSet bool +} + +func (v NullableFindProjectHardwareReservationsProvisionableParameter) Get() *FindProjectHardwareReservationsProvisionableParameter { + return v.value +} + +func (v *NullableFindProjectHardwareReservationsProvisionableParameter) Set(val *FindProjectHardwareReservationsProvisionableParameter) { + v.value = val + v.isSet = true +} + +func (v NullableFindProjectHardwareReservationsProvisionableParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableFindProjectHardwareReservationsProvisionableParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindProjectHardwareReservationsProvisionableParameter(val *FindProjectHardwareReservationsProvisionableParameter) *NullableFindProjectHardwareReservationsProvisionableParameter { + return &NullableFindProjectHardwareReservationsProvisionableParameter{value: val, isSet: true} +} + +func (v NullableFindProjectHardwareReservationsProvisionableParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindProjectHardwareReservationsProvisionableParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_project_hardware_reservations_state_parameter.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_project_hardware_reservations_state_parameter.go new file mode 100644 index 00000000..14a368b8 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_project_hardware_reservations_state_parameter.go @@ -0,0 +1,113 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindProjectHardwareReservationsStateParameter the model 'FindProjectHardwareReservationsStateParameter' +type FindProjectHardwareReservationsStateParameter string + +// List of findProjectHardwareReservations_state_parameter +const ( + FINDPROJECTHARDWARERESERVATIONSSTATEPARAMETER_ACTIVE FindProjectHardwareReservationsStateParameter = "active" + FINDPROJECTHARDWARERESERVATIONSSTATEPARAMETER_SPARE FindProjectHardwareReservationsStateParameter = "spare" + FINDPROJECTHARDWARERESERVATIONSSTATEPARAMETER_NEED_OF_SERVICE FindProjectHardwareReservationsStateParameter = "need_of_service" +) + +// All allowed values of FindProjectHardwareReservationsStateParameter enum +var AllowedFindProjectHardwareReservationsStateParameterEnumValues = []FindProjectHardwareReservationsStateParameter{ + "active", + "spare", + "need_of_service", +} + +func (v *FindProjectHardwareReservationsStateParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FindProjectHardwareReservationsStateParameter(value) + for _, existing := range AllowedFindProjectHardwareReservationsStateParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FindProjectHardwareReservationsStateParameter", value) +} + +// NewFindProjectHardwareReservationsStateParameterFromValue returns a pointer to a valid FindProjectHardwareReservationsStateParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFindProjectHardwareReservationsStateParameterFromValue(v string) (*FindProjectHardwareReservationsStateParameter, error) { + ev := FindProjectHardwareReservationsStateParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FindProjectHardwareReservationsStateParameter: valid values are %v", v, AllowedFindProjectHardwareReservationsStateParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FindProjectHardwareReservationsStateParameter) IsValid() bool { + for _, existing := range AllowedFindProjectHardwareReservationsStateParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to findProjectHardwareReservations_state_parameter value +func (v FindProjectHardwareReservationsStateParameter) Ptr() *FindProjectHardwareReservationsStateParameter { + return &v +} + +type NullableFindProjectHardwareReservationsStateParameter struct { + value *FindProjectHardwareReservationsStateParameter + isSet bool +} + +func (v NullableFindProjectHardwareReservationsStateParameter) Get() *FindProjectHardwareReservationsStateParameter { + return v.value +} + +func (v *NullableFindProjectHardwareReservationsStateParameter) Set(val *FindProjectHardwareReservationsStateParameter) { + v.value = val + v.isSet = true +} + +func (v NullableFindProjectHardwareReservationsStateParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableFindProjectHardwareReservationsStateParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindProjectHardwareReservationsStateParameter(val *FindProjectHardwareReservationsStateParameter) *NullableFindProjectHardwareReservationsStateParameter { + return &NullableFindProjectHardwareReservationsStateParameter{value: val, isSet: true} +} + +func (v NullableFindProjectHardwareReservationsStateParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindProjectHardwareReservationsStateParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_bucket_parameter.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_bucket_parameter.go new file mode 100644 index 00000000..62ee5217 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_bucket_parameter.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindTrafficBucketParameter the model 'FindTrafficBucketParameter' +type FindTrafficBucketParameter string + +// List of findTraffic_bucket_parameter +const ( + FINDTRAFFICBUCKETPARAMETER_INTERNAL FindTrafficBucketParameter = "internal" + FINDTRAFFICBUCKETPARAMETER_EXTERNAL FindTrafficBucketParameter = "external" +) + +// All allowed values of FindTrafficBucketParameter enum +var AllowedFindTrafficBucketParameterEnumValues = []FindTrafficBucketParameter{ + "internal", + "external", +} + +func (v *FindTrafficBucketParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FindTrafficBucketParameter(value) + for _, existing := range AllowedFindTrafficBucketParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FindTrafficBucketParameter", value) +} + +// NewFindTrafficBucketParameterFromValue returns a pointer to a valid FindTrafficBucketParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFindTrafficBucketParameterFromValue(v string) (*FindTrafficBucketParameter, error) { + ev := FindTrafficBucketParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FindTrafficBucketParameter: valid values are %v", v, AllowedFindTrafficBucketParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FindTrafficBucketParameter) IsValid() bool { + for _, existing := range AllowedFindTrafficBucketParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to findTraffic_bucket_parameter value +func (v FindTrafficBucketParameter) Ptr() *FindTrafficBucketParameter { + return &v +} + +type NullableFindTrafficBucketParameter struct { + value *FindTrafficBucketParameter + isSet bool +} + +func (v NullableFindTrafficBucketParameter) Get() *FindTrafficBucketParameter { + return v.value +} + +func (v *NullableFindTrafficBucketParameter) Set(val *FindTrafficBucketParameter) { + v.value = val + v.isSet = true +} + +func (v NullableFindTrafficBucketParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableFindTrafficBucketParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindTrafficBucketParameter(val *FindTrafficBucketParameter) *NullableFindTrafficBucketParameter { + return &NullableFindTrafficBucketParameter{value: val, isSet: true} +} + +func (v NullableFindTrafficBucketParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindTrafficBucketParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_direction_parameter.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_direction_parameter.go new file mode 100644 index 00000000..dac328bc --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_direction_parameter.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindTrafficDirectionParameter the model 'FindTrafficDirectionParameter' +type FindTrafficDirectionParameter string + +// List of findTraffic_direction_parameter +const ( + FINDTRAFFICDIRECTIONPARAMETER_INBOUND FindTrafficDirectionParameter = "inbound" + FINDTRAFFICDIRECTIONPARAMETER_OUTBOUND FindTrafficDirectionParameter = "outbound" +) + +// All allowed values of FindTrafficDirectionParameter enum +var AllowedFindTrafficDirectionParameterEnumValues = []FindTrafficDirectionParameter{ + "inbound", + "outbound", +} + +func (v *FindTrafficDirectionParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FindTrafficDirectionParameter(value) + for _, existing := range AllowedFindTrafficDirectionParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FindTrafficDirectionParameter", value) +} + +// NewFindTrafficDirectionParameterFromValue returns a pointer to a valid FindTrafficDirectionParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFindTrafficDirectionParameterFromValue(v string) (*FindTrafficDirectionParameter, error) { + ev := FindTrafficDirectionParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FindTrafficDirectionParameter: valid values are %v", v, AllowedFindTrafficDirectionParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FindTrafficDirectionParameter) IsValid() bool { + for _, existing := range AllowedFindTrafficDirectionParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to findTraffic_direction_parameter value +func (v FindTrafficDirectionParameter) Ptr() *FindTrafficDirectionParameter { + return &v +} + +type NullableFindTrafficDirectionParameter struct { + value *FindTrafficDirectionParameter + isSet bool +} + +func (v NullableFindTrafficDirectionParameter) Get() *FindTrafficDirectionParameter { + return v.value +} + +func (v *NullableFindTrafficDirectionParameter) Set(val *FindTrafficDirectionParameter) { + v.value = val + v.isSet = true +} + +func (v NullableFindTrafficDirectionParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableFindTrafficDirectionParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindTrafficDirectionParameter(val *FindTrafficDirectionParameter) *NullableFindTrafficDirectionParameter { + return &NullableFindTrafficDirectionParameter{value: val, isSet: true} +} + +func (v NullableFindTrafficDirectionParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindTrafficDirectionParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_interval_parameter.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_interval_parameter.go new file mode 100644 index 00000000..f88b222f --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_interval_parameter.go @@ -0,0 +1,127 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// FindTrafficIntervalParameter the model 'FindTrafficIntervalParameter' +type FindTrafficIntervalParameter string + +// List of findTraffic_interval_parameter +const ( + FINDTRAFFICINTERVALPARAMETER_MINUTE FindTrafficIntervalParameter = "minute" + FINDTRAFFICINTERVALPARAMETER_HOUR FindTrafficIntervalParameter = "hour" + FINDTRAFFICINTERVALPARAMETER_DAY FindTrafficIntervalParameter = "day" + FINDTRAFFICINTERVALPARAMETER_WEEK FindTrafficIntervalParameter = "week" + FINDTRAFFICINTERVALPARAMETER_MONTH FindTrafficIntervalParameter = "month" + FINDTRAFFICINTERVALPARAMETER_YEAR FindTrafficIntervalParameter = "year" + FINDTRAFFICINTERVALPARAMETER_HOUR_OF_DAY FindTrafficIntervalParameter = "hour_of_day" + FINDTRAFFICINTERVALPARAMETER_DAY_OF_WEEK FindTrafficIntervalParameter = "day_of_week" + FINDTRAFFICINTERVALPARAMETER_DAY_OF_MONTH FindTrafficIntervalParameter = "day_of_month" + FINDTRAFFICINTERVALPARAMETER_MONTH_OF_YEAR FindTrafficIntervalParameter = "month_of_year" +) + +// All allowed values of FindTrafficIntervalParameter enum +var AllowedFindTrafficIntervalParameterEnumValues = []FindTrafficIntervalParameter{ + "minute", + "hour", + "day", + "week", + "month", + "year", + "hour_of_day", + "day_of_week", + "day_of_month", + "month_of_year", +} + +func (v *FindTrafficIntervalParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FindTrafficIntervalParameter(value) + for _, existing := range AllowedFindTrafficIntervalParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FindTrafficIntervalParameter", value) +} + +// NewFindTrafficIntervalParameterFromValue returns a pointer to a valid FindTrafficIntervalParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFindTrafficIntervalParameterFromValue(v string) (*FindTrafficIntervalParameter, error) { + ev := FindTrafficIntervalParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FindTrafficIntervalParameter: valid values are %v", v, AllowedFindTrafficIntervalParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FindTrafficIntervalParameter) IsValid() bool { + for _, existing := range AllowedFindTrafficIntervalParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to findTraffic_interval_parameter value +func (v FindTrafficIntervalParameter) Ptr() *FindTrafficIntervalParameter { + return &v +} + +type NullableFindTrafficIntervalParameter struct { + value *FindTrafficIntervalParameter + isSet bool +} + +func (v NullableFindTrafficIntervalParameter) Get() *FindTrafficIntervalParameter { + return v.value +} + +func (v *NullableFindTrafficIntervalParameter) Set(val *FindTrafficIntervalParameter) { + v.value = val + v.isSet = true +} + +func (v NullableFindTrafficIntervalParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableFindTrafficIntervalParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindTrafficIntervalParameter(val *FindTrafficIntervalParameter) *NullableFindTrafficIntervalParameter { + return &NullableFindTrafficIntervalParameter{value: val, isSet: true} +} + +func (v NullableFindTrafficIntervalParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindTrafficIntervalParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_timeframe_parameter.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_timeframe_parameter.go new file mode 100644 index 00000000..aa314b1d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_find_traffic_timeframe_parameter.go @@ -0,0 +1,197 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the FindTrafficTimeframeParameter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FindTrafficTimeframeParameter{} + +// FindTrafficTimeframeParameter struct for FindTrafficTimeframeParameter +type FindTrafficTimeframeParameter struct { + EndedAt time.Time `json:"ended_at"` + StartedAt time.Time `json:"started_at"` + AdditionalProperties map[string]interface{} +} + +type _FindTrafficTimeframeParameter FindTrafficTimeframeParameter + +// NewFindTrafficTimeframeParameter instantiates a new FindTrafficTimeframeParameter object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFindTrafficTimeframeParameter(endedAt time.Time, startedAt time.Time) *FindTrafficTimeframeParameter { + this := FindTrafficTimeframeParameter{} + this.EndedAt = endedAt + this.StartedAt = startedAt + return &this +} + +// NewFindTrafficTimeframeParameterWithDefaults instantiates a new FindTrafficTimeframeParameter object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFindTrafficTimeframeParameterWithDefaults() *FindTrafficTimeframeParameter { + this := FindTrafficTimeframeParameter{} + return &this +} + +// GetEndedAt returns the EndedAt field value +func (o *FindTrafficTimeframeParameter) GetEndedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.EndedAt +} + +// GetEndedAtOk returns a tuple with the EndedAt field value +// and a boolean to check if the value has been set. +func (o *FindTrafficTimeframeParameter) GetEndedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.EndedAt, true +} + +// SetEndedAt sets field value +func (o *FindTrafficTimeframeParameter) SetEndedAt(v time.Time) { + o.EndedAt = v +} + +// GetStartedAt returns the StartedAt field value +func (o *FindTrafficTimeframeParameter) GetStartedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.StartedAt +} + +// GetStartedAtOk returns a tuple with the StartedAt field value +// and a boolean to check if the value has been set. +func (o *FindTrafficTimeframeParameter) GetStartedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.StartedAt, true +} + +// SetStartedAt sets field value +func (o *FindTrafficTimeframeParameter) SetStartedAt(v time.Time) { + o.StartedAt = v +} + +func (o FindTrafficTimeframeParameter) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FindTrafficTimeframeParameter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["ended_at"] = o.EndedAt + toSerialize["started_at"] = o.StartedAt + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FindTrafficTimeframeParameter) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "ended_at", + "started_at", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFindTrafficTimeframeParameter := _FindTrafficTimeframeParameter{} + + err = json.Unmarshal(data, &varFindTrafficTimeframeParameter) + + if err != nil { + return err + } + + *o = FindTrafficTimeframeParameter(varFindTrafficTimeframeParameter) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ended_at") + delete(additionalProperties, "started_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFindTrafficTimeframeParameter struct { + value *FindTrafficTimeframeParameter + isSet bool +} + +func (v NullableFindTrafficTimeframeParameter) Get() *FindTrafficTimeframeParameter { + return v.value +} + +func (v *NullableFindTrafficTimeframeParameter) Set(val *FindTrafficTimeframeParameter) { + v.value = val + v.isSet = true +} + +func (v NullableFindTrafficTimeframeParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableFindTrafficTimeframeParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindTrafficTimeframeParameter(val *FindTrafficTimeframeParameter) *NullableFindTrafficTimeframeParameter { + return &NullableFindTrafficTimeframeParameter{value: val, isSet: true} +} + +func (v NullableFindTrafficTimeframeParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindTrafficTimeframeParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set.go new file mode 100644 index 00000000..47fe5203 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set.go @@ -0,0 +1,351 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the FirmwareSet type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FirmwareSet{} + +// FirmwareSet Represents a Firmware Set +type FirmwareSet struct { + // Firmware Set UUID + Uuid string `json:"uuid"` + // Firmware Set Name + Name string `json:"name"` + // Datetime when the block was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Datetime when the block was updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // Represents a list of attributes + Attributes []Attribute `json:"attributes,omitempty"` + // List of components versions + ComponentFirmware []Component `json:"component_firmware,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _FirmwareSet FirmwareSet + +// NewFirmwareSet instantiates a new FirmwareSet object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFirmwareSet(uuid string, name string) *FirmwareSet { + this := FirmwareSet{} + this.Uuid = uuid + this.Name = name + return &this +} + +// NewFirmwareSetWithDefaults instantiates a new FirmwareSet object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFirmwareSetWithDefaults() *FirmwareSet { + this := FirmwareSet{} + return &this +} + +// GetUuid returns the Uuid field value +func (o *FirmwareSet) GetUuid() string { + if o == nil { + var ret string + return ret + } + + return o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value +// and a boolean to check if the value has been set. +func (o *FirmwareSet) GetUuidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Uuid, true +} + +// SetUuid sets field value +func (o *FirmwareSet) SetUuid(v string) { + o.Uuid = v +} + +// GetName returns the Name field value +func (o *FirmwareSet) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *FirmwareSet) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *FirmwareSet) SetName(v string) { + o.Name = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *FirmwareSet) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FirmwareSet) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *FirmwareSet) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *FirmwareSet) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *FirmwareSet) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FirmwareSet) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *FirmwareSet) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *FirmwareSet) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *FirmwareSet) GetAttributes() []Attribute { + if o == nil || IsNil(o.Attributes) { + var ret []Attribute + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FirmwareSet) GetAttributesOk() ([]Attribute, bool) { + if o == nil || IsNil(o.Attributes) { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *FirmwareSet) HasAttributes() bool { + if o != nil && !IsNil(o.Attributes) { + return true + } + + return false +} + +// SetAttributes gets a reference to the given []Attribute and assigns it to the Attributes field. +func (o *FirmwareSet) SetAttributes(v []Attribute) { + o.Attributes = v +} + +// GetComponentFirmware returns the ComponentFirmware field value if set, zero value otherwise. +func (o *FirmwareSet) GetComponentFirmware() []Component { + if o == nil || IsNil(o.ComponentFirmware) { + var ret []Component + return ret + } + return o.ComponentFirmware +} + +// GetComponentFirmwareOk returns a tuple with the ComponentFirmware field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FirmwareSet) GetComponentFirmwareOk() ([]Component, bool) { + if o == nil || IsNil(o.ComponentFirmware) { + return nil, false + } + return o.ComponentFirmware, true +} + +// HasComponentFirmware returns a boolean if a field has been set. +func (o *FirmwareSet) HasComponentFirmware() bool { + if o != nil && !IsNil(o.ComponentFirmware) { + return true + } + + return false +} + +// SetComponentFirmware gets a reference to the given []Component and assigns it to the ComponentFirmware field. +func (o *FirmwareSet) SetComponentFirmware(v []Component) { + o.ComponentFirmware = v +} + +func (o FirmwareSet) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FirmwareSet) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["uuid"] = o.Uuid + toSerialize["name"] = o.Name + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Attributes) { + toSerialize["attributes"] = o.Attributes + } + if !IsNil(o.ComponentFirmware) { + toSerialize["component_firmware"] = o.ComponentFirmware + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FirmwareSet) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "uuid", + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFirmwareSet := _FirmwareSet{} + + err = json.Unmarshal(data, &varFirmwareSet) + + if err != nil { + return err + } + + *o = FirmwareSet(varFirmwareSet) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "uuid") + delete(additionalProperties, "name") + delete(additionalProperties, "created_at") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "attributes") + delete(additionalProperties, "component_firmware") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFirmwareSet struct { + value *FirmwareSet + isSet bool +} + +func (v NullableFirmwareSet) Get() *FirmwareSet { + return v.value +} + +func (v *NullableFirmwareSet) Set(val *FirmwareSet) { + v.value = val + v.isSet = true +} + +func (v NullableFirmwareSet) IsSet() bool { + return v.isSet +} + +func (v *NullableFirmwareSet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFirmwareSet(val *FirmwareSet) *NullableFirmwareSet { + return &NullableFirmwareSet{value: val, isSet: true} +} + +func (v NullableFirmwareSet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFirmwareSet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set_list_response.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set_list_response.go new file mode 100644 index 00000000..d1230053 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set_list_response.go @@ -0,0 +1,345 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the FirmwareSetListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FirmwareSetListResponse{} + +// FirmwareSetListResponse Represents collection of Firmware Sets +type FirmwareSetListResponse struct { + // Max number of items returned in a page + PageSize *int32 `json:"page_size,omitempty"` + // Page returned + Page *int32 `json:"page,omitempty"` + // Items returned in current page + PageCount *int32 `json:"page_count,omitempty"` + // Total count of pages + TotalPages *int32 `json:"total_pages,omitempty"` + // Total count of items + TotalRecordCount *int32 `json:"total_record_count,omitempty"` + // Represents a list of FirmwareSets + Records []FirmwareSet `json:"records,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _FirmwareSetListResponse FirmwareSetListResponse + +// NewFirmwareSetListResponse instantiates a new FirmwareSetListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFirmwareSetListResponse() *FirmwareSetListResponse { + this := FirmwareSetListResponse{} + return &this +} + +// NewFirmwareSetListResponseWithDefaults instantiates a new FirmwareSetListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFirmwareSetListResponseWithDefaults() *FirmwareSetListResponse { + this := FirmwareSetListResponse{} + return &this +} + +// GetPageSize returns the PageSize field value if set, zero value otherwise. +func (o *FirmwareSetListResponse) GetPageSize() int32 { + if o == nil || IsNil(o.PageSize) { + var ret int32 + return ret + } + return *o.PageSize +} + +// GetPageSizeOk returns a tuple with the PageSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FirmwareSetListResponse) GetPageSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PageSize) { + return nil, false + } + return o.PageSize, true +} + +// HasPageSize returns a boolean if a field has been set. +func (o *FirmwareSetListResponse) HasPageSize() bool { + if o != nil && !IsNil(o.PageSize) { + return true + } + + return false +} + +// SetPageSize gets a reference to the given int32 and assigns it to the PageSize field. +func (o *FirmwareSetListResponse) SetPageSize(v int32) { + o.PageSize = &v +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *FirmwareSetListResponse) GetPage() int32 { + if o == nil || IsNil(o.Page) { + var ret int32 + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FirmwareSetListResponse) GetPageOk() (*int32, bool) { + if o == nil || IsNil(o.Page) { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *FirmwareSetListResponse) HasPage() bool { + if o != nil && !IsNil(o.Page) { + return true + } + + return false +} + +// SetPage gets a reference to the given int32 and assigns it to the Page field. +func (o *FirmwareSetListResponse) SetPage(v int32) { + o.Page = &v +} + +// GetPageCount returns the PageCount field value if set, zero value otherwise. +func (o *FirmwareSetListResponse) GetPageCount() int32 { + if o == nil || IsNil(o.PageCount) { + var ret int32 + return ret + } + return *o.PageCount +} + +// GetPageCountOk returns a tuple with the PageCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FirmwareSetListResponse) GetPageCountOk() (*int32, bool) { + if o == nil || IsNil(o.PageCount) { + return nil, false + } + return o.PageCount, true +} + +// HasPageCount returns a boolean if a field has been set. +func (o *FirmwareSetListResponse) HasPageCount() bool { + if o != nil && !IsNil(o.PageCount) { + return true + } + + return false +} + +// SetPageCount gets a reference to the given int32 and assigns it to the PageCount field. +func (o *FirmwareSetListResponse) SetPageCount(v int32) { + o.PageCount = &v +} + +// GetTotalPages returns the TotalPages field value if set, zero value otherwise. +func (o *FirmwareSetListResponse) GetTotalPages() int32 { + if o == nil || IsNil(o.TotalPages) { + var ret int32 + return ret + } + return *o.TotalPages +} + +// GetTotalPagesOk returns a tuple with the TotalPages field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FirmwareSetListResponse) GetTotalPagesOk() (*int32, bool) { + if o == nil || IsNil(o.TotalPages) { + return nil, false + } + return o.TotalPages, true +} + +// HasTotalPages returns a boolean if a field has been set. +func (o *FirmwareSetListResponse) HasTotalPages() bool { + if o != nil && !IsNil(o.TotalPages) { + return true + } + + return false +} + +// SetTotalPages gets a reference to the given int32 and assigns it to the TotalPages field. +func (o *FirmwareSetListResponse) SetTotalPages(v int32) { + o.TotalPages = &v +} + +// GetTotalRecordCount returns the TotalRecordCount field value if set, zero value otherwise. +func (o *FirmwareSetListResponse) GetTotalRecordCount() int32 { + if o == nil || IsNil(o.TotalRecordCount) { + var ret int32 + return ret + } + return *o.TotalRecordCount +} + +// GetTotalRecordCountOk returns a tuple with the TotalRecordCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FirmwareSetListResponse) GetTotalRecordCountOk() (*int32, bool) { + if o == nil || IsNil(o.TotalRecordCount) { + return nil, false + } + return o.TotalRecordCount, true +} + +// HasTotalRecordCount returns a boolean if a field has been set. +func (o *FirmwareSetListResponse) HasTotalRecordCount() bool { + if o != nil && !IsNil(o.TotalRecordCount) { + return true + } + + return false +} + +// SetTotalRecordCount gets a reference to the given int32 and assigns it to the TotalRecordCount field. +func (o *FirmwareSetListResponse) SetTotalRecordCount(v int32) { + o.TotalRecordCount = &v +} + +// GetRecords returns the Records field value if set, zero value otherwise. +func (o *FirmwareSetListResponse) GetRecords() []FirmwareSet { + if o == nil || IsNil(o.Records) { + var ret []FirmwareSet + return ret + } + return o.Records +} + +// GetRecordsOk returns a tuple with the Records field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FirmwareSetListResponse) GetRecordsOk() ([]FirmwareSet, bool) { + if o == nil || IsNil(o.Records) { + return nil, false + } + return o.Records, true +} + +// HasRecords returns a boolean if a field has been set. +func (o *FirmwareSetListResponse) HasRecords() bool { + if o != nil && !IsNil(o.Records) { + return true + } + + return false +} + +// SetRecords gets a reference to the given []FirmwareSet and assigns it to the Records field. +func (o *FirmwareSetListResponse) SetRecords(v []FirmwareSet) { + o.Records = v +} + +func (o FirmwareSetListResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FirmwareSetListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.PageSize) { + toSerialize["page_size"] = o.PageSize + } + if !IsNil(o.Page) { + toSerialize["page"] = o.Page + } + if !IsNil(o.PageCount) { + toSerialize["page_count"] = o.PageCount + } + if !IsNil(o.TotalPages) { + toSerialize["total_pages"] = o.TotalPages + } + if !IsNil(o.TotalRecordCount) { + toSerialize["total_record_count"] = o.TotalRecordCount + } + if !IsNil(o.Records) { + toSerialize["records"] = o.Records + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FirmwareSetListResponse) UnmarshalJSON(data []byte) (err error) { + varFirmwareSetListResponse := _FirmwareSetListResponse{} + + err = json.Unmarshal(data, &varFirmwareSetListResponse) + + if err != nil { + return err + } + + *o = FirmwareSetListResponse(varFirmwareSetListResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "page_size") + delete(additionalProperties, "page") + delete(additionalProperties, "page_count") + delete(additionalProperties, "total_pages") + delete(additionalProperties, "total_record_count") + delete(additionalProperties, "records") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFirmwareSetListResponse struct { + value *FirmwareSetListResponse + isSet bool +} + +func (v NullableFirmwareSetListResponse) Get() *FirmwareSetListResponse { + return v.value +} + +func (v *NullableFirmwareSetListResponse) Set(val *FirmwareSetListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableFirmwareSetListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableFirmwareSetListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFirmwareSetListResponse(val *FirmwareSetListResponse) *NullableFirmwareSetListResponse { + return &NullableFirmwareSetListResponse{value: val, isSet: true} +} + +func (v NullableFirmwareSetListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFirmwareSetListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set_response.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set_response.go new file mode 100644 index 00000000..68eb40e6 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_firmware_set_response.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the FirmwareSetResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FirmwareSetResponse{} + +// FirmwareSetResponse Represents single Firmware set response +type FirmwareSetResponse struct { + Record *FirmwareSet `json:"record,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _FirmwareSetResponse FirmwareSetResponse + +// NewFirmwareSetResponse instantiates a new FirmwareSetResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFirmwareSetResponse() *FirmwareSetResponse { + this := FirmwareSetResponse{} + return &this +} + +// NewFirmwareSetResponseWithDefaults instantiates a new FirmwareSetResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFirmwareSetResponseWithDefaults() *FirmwareSetResponse { + this := FirmwareSetResponse{} + return &this +} + +// GetRecord returns the Record field value if set, zero value otherwise. +func (o *FirmwareSetResponse) GetRecord() FirmwareSet { + if o == nil || IsNil(o.Record) { + var ret FirmwareSet + return ret + } + return *o.Record +} + +// GetRecordOk returns a tuple with the Record field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FirmwareSetResponse) GetRecordOk() (*FirmwareSet, bool) { + if o == nil || IsNil(o.Record) { + return nil, false + } + return o.Record, true +} + +// HasRecord returns a boolean if a field has been set. +func (o *FirmwareSetResponse) HasRecord() bool { + if o != nil && !IsNil(o.Record) { + return true + } + + return false +} + +// SetRecord gets a reference to the given FirmwareSet and assigns it to the Record field. +func (o *FirmwareSetResponse) SetRecord(v FirmwareSet) { + o.Record = &v +} + +func (o FirmwareSetResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FirmwareSetResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Record) { + toSerialize["record"] = o.Record + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FirmwareSetResponse) UnmarshalJSON(data []byte) (err error) { + varFirmwareSetResponse := _FirmwareSetResponse{} + + err = json.Unmarshal(data, &varFirmwareSetResponse) + + if err != nil { + return err + } + + *o = FirmwareSetResponse(varFirmwareSetResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "record") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFirmwareSetResponse struct { + value *FirmwareSetResponse + isSet bool +} + +func (v NullableFirmwareSetResponse) Get() *FirmwareSetResponse { + return v.value +} + +func (v *NullableFirmwareSetResponse) Set(val *FirmwareSetResponse) { + v.value = val + v.isSet = true +} + +func (v NullableFirmwareSetResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableFirmwareSetResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFirmwareSetResponse(val *FirmwareSetResponse) *NullableFirmwareSetResponse { + return &NullableFirmwareSetResponse{value: val, isSet: true} +} + +func (v NullableFirmwareSetResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFirmwareSetResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_global_bgp_range.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_global_bgp_range.go new file mode 100644 index 00000000..7a02f679 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_global_bgp_range.go @@ -0,0 +1,302 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the GlobalBgpRange type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GlobalBgpRange{} + +// GlobalBgpRange struct for GlobalBgpRange +type GlobalBgpRange struct { + AddressFamily *int32 `json:"address_family,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Project *Href `json:"project,omitempty"` + Range *string `json:"range,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GlobalBgpRange GlobalBgpRange + +// NewGlobalBgpRange instantiates a new GlobalBgpRange object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGlobalBgpRange() *GlobalBgpRange { + this := GlobalBgpRange{} + return &this +} + +// NewGlobalBgpRangeWithDefaults instantiates a new GlobalBgpRange object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGlobalBgpRangeWithDefaults() *GlobalBgpRange { + this := GlobalBgpRange{} + return &this +} + +// GetAddressFamily returns the AddressFamily field value if set, zero value otherwise. +func (o *GlobalBgpRange) GetAddressFamily() int32 { + if o == nil || IsNil(o.AddressFamily) { + var ret int32 + return ret + } + return *o.AddressFamily +} + +// GetAddressFamilyOk returns a tuple with the AddressFamily field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalBgpRange) GetAddressFamilyOk() (*int32, bool) { + if o == nil || IsNil(o.AddressFamily) { + return nil, false + } + return o.AddressFamily, true +} + +// HasAddressFamily returns a boolean if a field has been set. +func (o *GlobalBgpRange) HasAddressFamily() bool { + if o != nil && !IsNil(o.AddressFamily) { + return true + } + + return false +} + +// SetAddressFamily gets a reference to the given int32 and assigns it to the AddressFamily field. +func (o *GlobalBgpRange) SetAddressFamily(v int32) { + o.AddressFamily = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *GlobalBgpRange) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalBgpRange) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *GlobalBgpRange) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *GlobalBgpRange) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GlobalBgpRange) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalBgpRange) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *GlobalBgpRange) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GlobalBgpRange) SetId(v string) { + o.Id = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *GlobalBgpRange) GetProject() Href { + if o == nil || IsNil(o.Project) { + var ret Href + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalBgpRange) GetProjectOk() (*Href, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *GlobalBgpRange) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Href and assigns it to the Project field. +func (o *GlobalBgpRange) SetProject(v Href) { + o.Project = &v +} + +// GetRange returns the Range field value if set, zero value otherwise. +func (o *GlobalBgpRange) GetRange() string { + if o == nil || IsNil(o.Range) { + var ret string + return ret + } + return *o.Range +} + +// GetRangeOk returns a tuple with the Range field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalBgpRange) GetRangeOk() (*string, bool) { + if o == nil || IsNil(o.Range) { + return nil, false + } + return o.Range, true +} + +// HasRange returns a boolean if a field has been set. +func (o *GlobalBgpRange) HasRange() bool { + if o != nil && !IsNil(o.Range) { + return true + } + + return false +} + +// SetRange gets a reference to the given string and assigns it to the Range field. +func (o *GlobalBgpRange) SetRange(v string) { + o.Range = &v +} + +func (o GlobalBgpRange) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GlobalBgpRange) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AddressFamily) { + toSerialize["address_family"] = o.AddressFamily + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.Range) { + toSerialize["range"] = o.Range + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GlobalBgpRange) UnmarshalJSON(data []byte) (err error) { + varGlobalBgpRange := _GlobalBgpRange{} + + err = json.Unmarshal(data, &varGlobalBgpRange) + + if err != nil { + return err + } + + *o = GlobalBgpRange(varGlobalBgpRange) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address_family") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "project") + delete(additionalProperties, "range") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGlobalBgpRange struct { + value *GlobalBgpRange + isSet bool +} + +func (v NullableGlobalBgpRange) Get() *GlobalBgpRange { + return v.value +} + +func (v *NullableGlobalBgpRange) Set(val *GlobalBgpRange) { + v.value = val + v.isSet = true +} + +func (v NullableGlobalBgpRange) IsSet() bool { + return v.isSet +} + +func (v *NullableGlobalBgpRange) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGlobalBgpRange(val *GlobalBgpRange) *NullableGlobalBgpRange { + return &NullableGlobalBgpRange{value: val, isSet: true} +} + +func (v NullableGlobalBgpRange) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGlobalBgpRange) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_global_bgp_range_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_global_bgp_range_list.go new file mode 100644 index 00000000..3db165ea --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_global_bgp_range_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the GlobalBgpRangeList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GlobalBgpRangeList{} + +// GlobalBgpRangeList struct for GlobalBgpRangeList +type GlobalBgpRangeList struct { + GlobalBgpRanges []GlobalBgpRange `json:"global_bgp_ranges,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GlobalBgpRangeList GlobalBgpRangeList + +// NewGlobalBgpRangeList instantiates a new GlobalBgpRangeList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGlobalBgpRangeList() *GlobalBgpRangeList { + this := GlobalBgpRangeList{} + return &this +} + +// NewGlobalBgpRangeListWithDefaults instantiates a new GlobalBgpRangeList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGlobalBgpRangeListWithDefaults() *GlobalBgpRangeList { + this := GlobalBgpRangeList{} + return &this +} + +// GetGlobalBgpRanges returns the GlobalBgpRanges field value if set, zero value otherwise. +func (o *GlobalBgpRangeList) GetGlobalBgpRanges() []GlobalBgpRange { + if o == nil || IsNil(o.GlobalBgpRanges) { + var ret []GlobalBgpRange + return ret + } + return o.GlobalBgpRanges +} + +// GetGlobalBgpRangesOk returns a tuple with the GlobalBgpRanges field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GlobalBgpRangeList) GetGlobalBgpRangesOk() ([]GlobalBgpRange, bool) { + if o == nil || IsNil(o.GlobalBgpRanges) { + return nil, false + } + return o.GlobalBgpRanges, true +} + +// HasGlobalBgpRanges returns a boolean if a field has been set. +func (o *GlobalBgpRangeList) HasGlobalBgpRanges() bool { + if o != nil && !IsNil(o.GlobalBgpRanges) { + return true + } + + return false +} + +// SetGlobalBgpRanges gets a reference to the given []GlobalBgpRange and assigns it to the GlobalBgpRanges field. +func (o *GlobalBgpRangeList) SetGlobalBgpRanges(v []GlobalBgpRange) { + o.GlobalBgpRanges = v +} + +func (o GlobalBgpRangeList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GlobalBgpRangeList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.GlobalBgpRanges) { + toSerialize["global_bgp_ranges"] = o.GlobalBgpRanges + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GlobalBgpRangeList) UnmarshalJSON(data []byte) (err error) { + varGlobalBgpRangeList := _GlobalBgpRangeList{} + + err = json.Unmarshal(data, &varGlobalBgpRangeList) + + if err != nil { + return err + } + + *o = GlobalBgpRangeList(varGlobalBgpRangeList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "global_bgp_ranges") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGlobalBgpRangeList struct { + value *GlobalBgpRangeList + isSet bool +} + +func (v NullableGlobalBgpRangeList) Get() *GlobalBgpRangeList { + return v.value +} + +func (v *NullableGlobalBgpRangeList) Set(val *GlobalBgpRangeList) { + v.value = val + v.isSet = true +} + +func (v NullableGlobalBgpRangeList) IsSet() bool { + return v.isSet +} + +func (v *NullableGlobalBgpRangeList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGlobalBgpRangeList(val *GlobalBgpRangeList) *NullableGlobalBgpRangeList { + return &NullableGlobalBgpRangeList{value: val, isSet: true} +} + +func (v NullableGlobalBgpRangeList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGlobalBgpRangeList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_hardware_reservation.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_hardware_reservation.go new file mode 100644 index 00000000..8c752140 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_hardware_reservation.go @@ -0,0 +1,643 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the HardwareReservation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HardwareReservation{} + +// HardwareReservation struct for HardwareReservation +type HardwareReservation struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + // Amount that will be charged for every billing_cycle. + CustomRate *float32 `json:"custom_rate,omitempty"` + Device *Device `json:"device,omitempty"` + Facility *Facility `json:"facility,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + // Whether this Device requires assistance from Equinix Metal. + NeedOfService *bool `json:"need_of_service,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Project *Project `json:"project,omitempty"` + // Whether the reserved server is provisionable or not. Spare devices can't be provisioned unless they are activated first. + Provisionable *bool `json:"provisionable,omitempty"` + // Short version of the ID. + ShortId *string `json:"short_id,omitempty"` + // Whether the Hardware Reservation is a spare. Spare Hardware Reservations are used when a Hardware Reservations requires service from Equinix Metal + Spare *bool `json:"spare,omitempty"` + // Switch short id. This can be used to determine if two devices are connected to the same switch, for example. + SwitchUuid *string `json:"switch_uuid,omitempty"` + // Expiration date for the reservation. + TerminationTime *time.Time `json:"termination_time,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _HardwareReservation HardwareReservation + +// NewHardwareReservation instantiates a new HardwareReservation object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewHardwareReservation() *HardwareReservation { + this := HardwareReservation{} + return &this +} + +// NewHardwareReservationWithDefaults instantiates a new HardwareReservation object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewHardwareReservationWithDefaults() *HardwareReservation { + this := HardwareReservation{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *HardwareReservation) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *HardwareReservation) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *HardwareReservation) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCustomRate returns the CustomRate field value if set, zero value otherwise. +func (o *HardwareReservation) GetCustomRate() float32 { + if o == nil || IsNil(o.CustomRate) { + var ret float32 + return ret + } + return *o.CustomRate +} + +// GetCustomRateOk returns a tuple with the CustomRate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetCustomRateOk() (*float32, bool) { + if o == nil || IsNil(o.CustomRate) { + return nil, false + } + return o.CustomRate, true +} + +// HasCustomRate returns a boolean if a field has been set. +func (o *HardwareReservation) HasCustomRate() bool { + if o != nil && !IsNil(o.CustomRate) { + return true + } + + return false +} + +// SetCustomRate gets a reference to the given float32 and assigns it to the CustomRate field. +func (o *HardwareReservation) SetCustomRate(v float32) { + o.CustomRate = &v +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *HardwareReservation) GetDevice() Device { + if o == nil || IsNil(o.Device) { + var ret Device + return ret + } + return *o.Device +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetDeviceOk() (*Device, bool) { + if o == nil || IsNil(o.Device) { + return nil, false + } + return o.Device, true +} + +// HasDevice returns a boolean if a field has been set. +func (o *HardwareReservation) HasDevice() bool { + if o != nil && !IsNil(o.Device) { + return true + } + + return false +} + +// SetDevice gets a reference to the given Device and assigns it to the Device field. +func (o *HardwareReservation) SetDevice(v Device) { + o.Device = &v +} + +// GetFacility returns the Facility field value if set, zero value otherwise. +func (o *HardwareReservation) GetFacility() Facility { + if o == nil || IsNil(o.Facility) { + var ret Facility + return ret + } + return *o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetFacilityOk() (*Facility, bool) { + if o == nil || IsNil(o.Facility) { + return nil, false + } + return o.Facility, true +} + +// HasFacility returns a boolean if a field has been set. +func (o *HardwareReservation) HasFacility() bool { + if o != nil && !IsNil(o.Facility) { + return true + } + + return false +} + +// SetFacility gets a reference to the given Facility and assigns it to the Facility field. +func (o *HardwareReservation) SetFacility(v Facility) { + o.Facility = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *HardwareReservation) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *HardwareReservation) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *HardwareReservation) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *HardwareReservation) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *HardwareReservation) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *HardwareReservation) SetId(v string) { + o.Id = &v +} + +// GetNeedOfService returns the NeedOfService field value if set, zero value otherwise. +func (o *HardwareReservation) GetNeedOfService() bool { + if o == nil || IsNil(o.NeedOfService) { + var ret bool + return ret + } + return *o.NeedOfService +} + +// GetNeedOfServiceOk returns a tuple with the NeedOfService field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetNeedOfServiceOk() (*bool, bool) { + if o == nil || IsNil(o.NeedOfService) { + return nil, false + } + return o.NeedOfService, true +} + +// HasNeedOfService returns a boolean if a field has been set. +func (o *HardwareReservation) HasNeedOfService() bool { + if o != nil && !IsNil(o.NeedOfService) { + return true + } + + return false +} + +// SetNeedOfService gets a reference to the given bool and assigns it to the NeedOfService field. +func (o *HardwareReservation) SetNeedOfService(v bool) { + o.NeedOfService = &v +} + +// GetPlan returns the Plan field value if set, zero value otherwise. +func (o *HardwareReservation) GetPlan() Plan { + if o == nil || IsNil(o.Plan) { + var ret Plan + return ret + } + return *o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetPlanOk() (*Plan, bool) { + if o == nil || IsNil(o.Plan) { + return nil, false + } + return o.Plan, true +} + +// HasPlan returns a boolean if a field has been set. +func (o *HardwareReservation) HasPlan() bool { + if o != nil && !IsNil(o.Plan) { + return true + } + + return false +} + +// SetPlan gets a reference to the given Plan and assigns it to the Plan field. +func (o *HardwareReservation) SetPlan(v Plan) { + o.Plan = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *HardwareReservation) GetProject() Project { + if o == nil || IsNil(o.Project) { + var ret Project + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetProjectOk() (*Project, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *HardwareReservation) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Project and assigns it to the Project field. +func (o *HardwareReservation) SetProject(v Project) { + o.Project = &v +} + +// GetProvisionable returns the Provisionable field value if set, zero value otherwise. +func (o *HardwareReservation) GetProvisionable() bool { + if o == nil || IsNil(o.Provisionable) { + var ret bool + return ret + } + return *o.Provisionable +} + +// GetProvisionableOk returns a tuple with the Provisionable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetProvisionableOk() (*bool, bool) { + if o == nil || IsNil(o.Provisionable) { + return nil, false + } + return o.Provisionable, true +} + +// HasProvisionable returns a boolean if a field has been set. +func (o *HardwareReservation) HasProvisionable() bool { + if o != nil && !IsNil(o.Provisionable) { + return true + } + + return false +} + +// SetProvisionable gets a reference to the given bool and assigns it to the Provisionable field. +func (o *HardwareReservation) SetProvisionable(v bool) { + o.Provisionable = &v +} + +// GetShortId returns the ShortId field value if set, zero value otherwise. +func (o *HardwareReservation) GetShortId() string { + if o == nil || IsNil(o.ShortId) { + var ret string + return ret + } + return *o.ShortId +} + +// GetShortIdOk returns a tuple with the ShortId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetShortIdOk() (*string, bool) { + if o == nil || IsNil(o.ShortId) { + return nil, false + } + return o.ShortId, true +} + +// HasShortId returns a boolean if a field has been set. +func (o *HardwareReservation) HasShortId() bool { + if o != nil && !IsNil(o.ShortId) { + return true + } + + return false +} + +// SetShortId gets a reference to the given string and assigns it to the ShortId field. +func (o *HardwareReservation) SetShortId(v string) { + o.ShortId = &v +} + +// GetSpare returns the Spare field value if set, zero value otherwise. +func (o *HardwareReservation) GetSpare() bool { + if o == nil || IsNil(o.Spare) { + var ret bool + return ret + } + return *o.Spare +} + +// GetSpareOk returns a tuple with the Spare field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetSpareOk() (*bool, bool) { + if o == nil || IsNil(o.Spare) { + return nil, false + } + return o.Spare, true +} + +// HasSpare returns a boolean if a field has been set. +func (o *HardwareReservation) HasSpare() bool { + if o != nil && !IsNil(o.Spare) { + return true + } + + return false +} + +// SetSpare gets a reference to the given bool and assigns it to the Spare field. +func (o *HardwareReservation) SetSpare(v bool) { + o.Spare = &v +} + +// GetSwitchUuid returns the SwitchUuid field value if set, zero value otherwise. +func (o *HardwareReservation) GetSwitchUuid() string { + if o == nil || IsNil(o.SwitchUuid) { + var ret string + return ret + } + return *o.SwitchUuid +} + +// GetSwitchUuidOk returns a tuple with the SwitchUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetSwitchUuidOk() (*string, bool) { + if o == nil || IsNil(o.SwitchUuid) { + return nil, false + } + return o.SwitchUuid, true +} + +// HasSwitchUuid returns a boolean if a field has been set. +func (o *HardwareReservation) HasSwitchUuid() bool { + if o != nil && !IsNil(o.SwitchUuid) { + return true + } + + return false +} + +// SetSwitchUuid gets a reference to the given string and assigns it to the SwitchUuid field. +func (o *HardwareReservation) SetSwitchUuid(v string) { + o.SwitchUuid = &v +} + +// GetTerminationTime returns the TerminationTime field value if set, zero value otherwise. +func (o *HardwareReservation) GetTerminationTime() time.Time { + if o == nil || IsNil(o.TerminationTime) { + var ret time.Time + return ret + } + return *o.TerminationTime +} + +// GetTerminationTimeOk returns a tuple with the TerminationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservation) GetTerminationTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.TerminationTime) { + return nil, false + } + return o.TerminationTime, true +} + +// HasTerminationTime returns a boolean if a field has been set. +func (o *HardwareReservation) HasTerminationTime() bool { + if o != nil && !IsNil(o.TerminationTime) { + return true + } + + return false +} + +// SetTerminationTime gets a reference to the given time.Time and assigns it to the TerminationTime field. +func (o *HardwareReservation) SetTerminationTime(v time.Time) { + o.TerminationTime = &v +} + +func (o HardwareReservation) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o HardwareReservation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.CustomRate) { + toSerialize["custom_rate"] = o.CustomRate + } + if !IsNil(o.Device) { + toSerialize["device"] = o.Device + } + if !IsNil(o.Facility) { + toSerialize["facility"] = o.Facility + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.NeedOfService) { + toSerialize["need_of_service"] = o.NeedOfService + } + if !IsNil(o.Plan) { + toSerialize["plan"] = o.Plan + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.Provisionable) { + toSerialize["provisionable"] = o.Provisionable + } + if !IsNil(o.ShortId) { + toSerialize["short_id"] = o.ShortId + } + if !IsNil(o.Spare) { + toSerialize["spare"] = o.Spare + } + if !IsNil(o.SwitchUuid) { + toSerialize["switch_uuid"] = o.SwitchUuid + } + if !IsNil(o.TerminationTime) { + toSerialize["termination_time"] = o.TerminationTime + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *HardwareReservation) UnmarshalJSON(data []byte) (err error) { + varHardwareReservation := _HardwareReservation{} + + err = json.Unmarshal(data, &varHardwareReservation) + + if err != nil { + return err + } + + *o = HardwareReservation(varHardwareReservation) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "custom_rate") + delete(additionalProperties, "device") + delete(additionalProperties, "facility") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "need_of_service") + delete(additionalProperties, "plan") + delete(additionalProperties, "project") + delete(additionalProperties, "provisionable") + delete(additionalProperties, "short_id") + delete(additionalProperties, "spare") + delete(additionalProperties, "switch_uuid") + delete(additionalProperties, "termination_time") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableHardwareReservation struct { + value *HardwareReservation + isSet bool +} + +func (v NullableHardwareReservation) Get() *HardwareReservation { + return v.value +} + +func (v *NullableHardwareReservation) Set(val *HardwareReservation) { + v.value = val + v.isSet = true +} + +func (v NullableHardwareReservation) IsSet() bool { + return v.isSet +} + +func (v *NullableHardwareReservation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHardwareReservation(val *HardwareReservation) *NullableHardwareReservation { + return &NullableHardwareReservation{value: val, isSet: true} +} + +func (v NullableHardwareReservation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHardwareReservation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_hardware_reservation_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_hardware_reservation_list.go new file mode 100644 index 00000000..c0d7f148 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_hardware_reservation_list.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the HardwareReservationList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HardwareReservationList{} + +// HardwareReservationList struct for HardwareReservationList +type HardwareReservationList struct { + HardwareReservations []HardwareReservation `json:"hardware_reservations,omitempty"` + Meta *Meta `json:"meta,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _HardwareReservationList HardwareReservationList + +// NewHardwareReservationList instantiates a new HardwareReservationList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewHardwareReservationList() *HardwareReservationList { + this := HardwareReservationList{} + return &this +} + +// NewHardwareReservationListWithDefaults instantiates a new HardwareReservationList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewHardwareReservationListWithDefaults() *HardwareReservationList { + this := HardwareReservationList{} + return &this +} + +// GetHardwareReservations returns the HardwareReservations field value if set, zero value otherwise. +func (o *HardwareReservationList) GetHardwareReservations() []HardwareReservation { + if o == nil || IsNil(o.HardwareReservations) { + var ret []HardwareReservation + return ret + } + return o.HardwareReservations +} + +// GetHardwareReservationsOk returns a tuple with the HardwareReservations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservationList) GetHardwareReservationsOk() ([]HardwareReservation, bool) { + if o == nil || IsNil(o.HardwareReservations) { + return nil, false + } + return o.HardwareReservations, true +} + +// HasHardwareReservations returns a boolean if a field has been set. +func (o *HardwareReservationList) HasHardwareReservations() bool { + if o != nil && !IsNil(o.HardwareReservations) { + return true + } + + return false +} + +// SetHardwareReservations gets a reference to the given []HardwareReservation and assigns it to the HardwareReservations field. +func (o *HardwareReservationList) SetHardwareReservations(v []HardwareReservation) { + o.HardwareReservations = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *HardwareReservationList) GetMeta() Meta { + if o == nil || IsNil(o.Meta) { + var ret Meta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HardwareReservationList) GetMetaOk() (*Meta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *HardwareReservationList) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given Meta and assigns it to the Meta field. +func (o *HardwareReservationList) SetMeta(v Meta) { + o.Meta = &v +} + +func (o HardwareReservationList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o HardwareReservationList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.HardwareReservations) { + toSerialize["hardware_reservations"] = o.HardwareReservations + } + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *HardwareReservationList) UnmarshalJSON(data []byte) (err error) { + varHardwareReservationList := _HardwareReservationList{} + + err = json.Unmarshal(data, &varHardwareReservationList) + + if err != nil { + return err + } + + *o = HardwareReservationList(varHardwareReservationList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "hardware_reservations") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableHardwareReservationList struct { + value *HardwareReservationList + isSet bool +} + +func (v NullableHardwareReservationList) Get() *HardwareReservationList { + return v.value +} + +func (v *NullableHardwareReservationList) Set(val *HardwareReservationList) { + v.value = val + v.isSet = true +} + +func (v NullableHardwareReservationList) IsSet() bool { + return v.isSet +} + +func (v *NullableHardwareReservationList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHardwareReservationList(val *HardwareReservationList) *NullableHardwareReservationList { + return &NullableHardwareReservationList{value: val, isSet: true} +} + +func (v NullableHardwareReservationList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHardwareReservationList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_href.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_href.go new file mode 100644 index 00000000..f9e943f2 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_href.go @@ -0,0 +1,167 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the Href type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Href{} + +// Href struct for Href +type Href struct { + Href string `json:"href"` + AdditionalProperties map[string]interface{} +} + +type _Href Href + +// NewHref instantiates a new Href object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewHref(href string) *Href { + this := Href{} + this.Href = href + return &this +} + +// NewHrefWithDefaults instantiates a new Href object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewHrefWithDefaults() *Href { + this := Href{} + return &this +} + +// GetHref returns the Href field value +func (o *Href) GetHref() string { + if o == nil { + var ret string + return ret + } + + return o.Href +} + +// GetHrefOk returns a tuple with the Href field value +// and a boolean to check if the value has been set. +func (o *Href) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Href, true +} + +// SetHref sets field value +func (o *Href) SetHref(v string) { + o.Href = v +} + +func (o Href) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Href) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["href"] = o.Href + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Href) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "href", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varHref := _Href{} + + err = json.Unmarshal(data, &varHref) + + if err != nil { + return err + } + + *o = Href(varHref) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "href") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableHref struct { + value *Href + isSet bool +} + +func (v NullableHref) Get() *Href { + return v.value +} + +func (v *NullableHref) Set(val *Href) { + v.value = val + v.isSet = true +} + +func (v NullableHref) IsSet() bool { + return v.isSet +} + +func (v *NullableHref) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHref(val *Href) *NullableHref { + return &NullableHref{value: val, isSet: true} +} + +func (v NullableHref) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHref) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_instances_batch_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_instances_batch_create_input.go new file mode 100644 index 00000000..dbfe7a4b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_instances_batch_create_input.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the InstancesBatchCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstancesBatchCreateInput{} + +// InstancesBatchCreateInput struct for InstancesBatchCreateInput +type InstancesBatchCreateInput struct { + Batches []InstancesBatchCreateInputBatchesInner `json:"batches,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InstancesBatchCreateInput InstancesBatchCreateInput + +// NewInstancesBatchCreateInput instantiates a new InstancesBatchCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInstancesBatchCreateInput() *InstancesBatchCreateInput { + this := InstancesBatchCreateInput{} + return &this +} + +// NewInstancesBatchCreateInputWithDefaults instantiates a new InstancesBatchCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInstancesBatchCreateInputWithDefaults() *InstancesBatchCreateInput { + this := InstancesBatchCreateInput{} + return &this +} + +// GetBatches returns the Batches field value if set, zero value otherwise. +func (o *InstancesBatchCreateInput) GetBatches() []InstancesBatchCreateInputBatchesInner { + if o == nil || IsNil(o.Batches) { + var ret []InstancesBatchCreateInputBatchesInner + return ret + } + return o.Batches +} + +// GetBatchesOk returns a tuple with the Batches field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInput) GetBatchesOk() ([]InstancesBatchCreateInputBatchesInner, bool) { + if o == nil || IsNil(o.Batches) { + return nil, false + } + return o.Batches, true +} + +// HasBatches returns a boolean if a field has been set. +func (o *InstancesBatchCreateInput) HasBatches() bool { + if o != nil && !IsNil(o.Batches) { + return true + } + + return false +} + +// SetBatches gets a reference to the given []InstancesBatchCreateInputBatchesInner and assigns it to the Batches field. +func (o *InstancesBatchCreateInput) SetBatches(v []InstancesBatchCreateInputBatchesInner) { + o.Batches = v +} + +func (o InstancesBatchCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstancesBatchCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Batches) { + toSerialize["batches"] = o.Batches + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstancesBatchCreateInput) UnmarshalJSON(data []byte) (err error) { + varInstancesBatchCreateInput := _InstancesBatchCreateInput{} + + err = json.Unmarshal(data, &varInstancesBatchCreateInput) + + if err != nil { + return err + } + + *o = InstancesBatchCreateInput(varInstancesBatchCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "batches") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstancesBatchCreateInput struct { + value *InstancesBatchCreateInput + isSet bool +} + +func (v NullableInstancesBatchCreateInput) Get() *InstancesBatchCreateInput { + return v.value +} + +func (v *NullableInstancesBatchCreateInput) Set(val *InstancesBatchCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableInstancesBatchCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableInstancesBatchCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstancesBatchCreateInput(val *InstancesBatchCreateInput) *NullableInstancesBatchCreateInput { + return &NullableInstancesBatchCreateInput{value: val, isSet: true} +} + +func (v NullableInstancesBatchCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstancesBatchCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_instances_batch_create_input_batches_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_instances_batch_create_input_batches_inner.go new file mode 100644 index 00000000..fc775db9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_instances_batch_create_input_batches_inner.go @@ -0,0 +1,1233 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the InstancesBatchCreateInputBatchesInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstancesBatchCreateInputBatchesInner{} + +// InstancesBatchCreateInputBatchesInner struct for InstancesBatchCreateInputBatchesInner +type InstancesBatchCreateInputBatchesInner struct { + Hostnames []string `json:"hostnames,omitempty"` + // The number of devices to create in this batch. The hostname may contain an `{{index}}` placeholder, which will be replaced with the index of the device in the batch. For example, if the hostname is `device-{{index}}`, the first device in the batch will have the hostname `device-01`, the second device will have the hostname `device-02`, and so on. + Quantity *int32 `json:"quantity,omitempty"` + // Metro code or ID of where the instance should be provisioned in. Either metro or facility must be provided. + Metro string `json:"metro"` + // When true, devices with a `custom_ipxe` OS will always boot to iPXE. The default setting of false ensures that iPXE will be used on only the first boot. + AlwaysPxe *bool `json:"always_pxe,omitempty"` + BillingCycle *DeviceCreateInputBillingCycle `json:"billing_cycle,omitempty"` + // Customdata is an arbitrary JSON value that can be accessed via the metadata service. + Customdata map[string]interface{} `json:"customdata,omitempty"` + // Any description of the device or how it will be used. This may be used to inform other API consumers with project access. + Description *string `json:"description,omitempty"` + // The features attribute allows you to optionally specify what features your server should have. In the API shorthand syntax, all features listed are `required`: ``` { \"features\": [\"tpm\"] } ``` Alternatively, if you do not require a certain feature, but would prefer to be assigned a server with that feature if there are any available, you may specify that feature with a `preferred` value. The request will not fail if we have no servers with that feature in our inventory. The API offers an alternative syntax for mixing preferred and required features: ``` { \"features\": { \"tpm\": \"required\", \"raid\": \"preferred\" } } ``` The request will only fail if there are no available servers matching the required `tpm` criteria. + Features []string `json:"features,omitempty"` + // The Hardware Reservation UUID to provision. Alternatively, `next-available` can be specified to select from any of the available hardware reservations. An error will be returned if the requested reservation option is not available. See [Reserved Hardware](https://metal.equinix.com/developers/docs/deploy/reserved/) for more details. + HardwareReservationId *string `json:"hardware_reservation_id,omitempty"` + // The hostname to use within the operating system. The same hostname may be used on multiple devices within a project. + Hostname *string `json:"hostname,omitempty"` + // The `ip_addresses attribute will allow you to specify the addresses you want created with your device. The default value configures public IPv4, public IPv6, and private IPv4. Private IPv4 address is required. When specifying `ip_addresses`, one of the array items must enable private IPv4. Some operating systems require public IPv4 address. In those cases you will receive an error message if public IPv4 is not enabled. For example, to only configure your server with a private IPv4 address, you can send `{ \"ip_addresses\": [{ \"address_family\": 4, \"public\": false }] }`. It is possible to request a subnet size larger than a `/30` by assigning addresses using the UUID(s) of ip_reservations in your project. For example, `{ \"ip_addresses\": [..., {\"address_family\": 4, \"public\": true, \"ip_reservations\": [\"uuid1\", \"uuid2\"]}] }` To access a server without public IPs, you can use our Out-of-Band console access (SOS) or proxy through another server in the project with public IPs enabled. + IpAddresses []IPAddress `json:"ip_addresses,omitempty"` + // When set, the device will chainload an iPXE Script at boot fetched from the supplied URL. See [Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/) for more details. + IpxeScriptUrl *string `json:"ipxe_script_url,omitempty"` + // Whether the device should be locked, preventing accidental deletion. + Locked *bool `json:"locked,omitempty"` + // If true, this instance can not be converted to a different network type. + NetworkFrozen *bool `json:"network_frozen,omitempty"` + // Overrides default behaviour of attaching all of the organization members ssh keys and project ssh keys to device if no specific keys specified + NoSshKeys *bool `json:"no_ssh_keys,omitempty"` + // The slug of the operating system to provision. Check the Equinix Metal operating system documentation for rules that may be imposed per operating system, including restrictions on IP address options and device plans. + OperatingSystem string `json:"operating_system"` + // The slug of the device plan to provision. + Plan string `json:"plan"` + // Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. + PrivateIpv4SubnetSize *int32 `json:"private_ipv4_subnet_size,omitempty"` + // A list of UUIDs identifying the device parent project that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. + ProjectSshKeys []string `json:"project_ssh_keys,omitempty"` + // Deprecated. Use ip_addresses. Subnet range for addresses allocated to this device. Your project must have addresses available for a non-default request. + PublicIpv4SubnetSize *int32 `json:"public_ipv4_subnet_size,omitempty"` + // Create a spot instance. Spot instances are created with a maximum bid price. If the bid price is not met, the spot instance will be terminated as indicated by the `termination_time` field. + SpotInstance *bool `json:"spot_instance,omitempty"` + // The maximum amount to bid for a spot instance. + SpotPriceMax *float32 `json:"spot_price_max,omitempty"` + // A list of new or existing project ssh_keys that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. These keys are added in addition to any keys defined by `project_ssh_keys` and `user_ssh_keys`. + SshKeys []SSHKeyInput `json:"ssh_keys,omitempty"` + Storage *Storage `json:"storage,omitempty"` + Tags []string `json:"tags,omitempty"` + // When the device will be terminated. If you don't supply timezone info, the timestamp is assumed to be in UTC. This is commonly set in advance for ephemeral spot market instances but this field may also be set with on-demand and reservation instances to automatically delete the resource at a given time. The termination time can also be used to release a hardware reservation instance at a given time, keeping the reservation open for other uses. On a spot market device, the termination time will be set automatically when outbid. + TerminationTime *time.Time `json:"termination_time,omitempty"` + // A list of UUIDs identifying the users that should be authorized to access this device (typically via /root/.ssh/authorized_keys). These keys will also appear in the device metadata. The users must be members of the project or organization. If no SSH keys are specified (`user_ssh_keys`, `project_ssh_keys`, and `ssh_keys` are all empty lists or omitted), all parent project keys, parent project members keys and organization members keys will be included. This behaviour can be changed with 'no_ssh_keys' option to omit any SSH key being added. + UserSshKeys []string `json:"user_ssh_keys,omitempty"` + // The userdata presented in the metadata service for this device. Userdata is fetched and interpreted by the operating system installed on the device. Acceptable formats are determined by the operating system, with the exception of a special iPXE enabling syntax which is handled before the operating system starts. See [Server User Data](https://metal.equinix.com/developers/docs/servers/user-data/) and [Provisioning with Custom iPXE](https://metal.equinix.com/developers/docs/operating-systems/custom-ipxe/#provisioning-with-custom-ipxe) for more details. + Userdata *string `json:"userdata,omitempty"` + // The datacenter where the device should be created. Either metro or facility must be provided. The API will accept either a single facility `{ \"facility\": \"f1\" }`, or it can be instructed to create the device in the best available datacenter `{ \"facility\": \"any\" }`. Additionally it is possible to set a prioritized location selection. For example `{ \"facility\": [\"f3\", \"f2\", \"any\"] }` can be used to prioritize `f3` and then `f2` before accepting `any` facility. If none of the facilities provided have availability for the requested device the request will fail. + // Deprecated + Facility []string `json:"facility"` + AdditionalProperties map[string]interface{} +} + +type _InstancesBatchCreateInputBatchesInner InstancesBatchCreateInputBatchesInner + +// NewInstancesBatchCreateInputBatchesInner instantiates a new InstancesBatchCreateInputBatchesInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInstancesBatchCreateInputBatchesInner(metro string, operatingSystem string, plan string, facility []string) *InstancesBatchCreateInputBatchesInner { + this := InstancesBatchCreateInputBatchesInner{} + this.Metro = metro + var alwaysPxe bool = false + this.AlwaysPxe = &alwaysPxe + var hardwareReservationId string = "" + this.HardwareReservationId = &hardwareReservationId + var locked bool = false + this.Locked = &locked + var noSshKeys bool = false + this.NoSshKeys = &noSshKeys + this.OperatingSystem = operatingSystem + this.Plan = plan + var privateIpv4SubnetSize int32 = 28 + this.PrivateIpv4SubnetSize = &privateIpv4SubnetSize + var publicIpv4SubnetSize int32 = 31 + this.PublicIpv4SubnetSize = &publicIpv4SubnetSize + this.Facility = facility + return &this +} + +// NewInstancesBatchCreateInputBatchesInnerWithDefaults instantiates a new InstancesBatchCreateInputBatchesInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInstancesBatchCreateInputBatchesInnerWithDefaults() *InstancesBatchCreateInputBatchesInner { + this := InstancesBatchCreateInputBatchesInner{} + var alwaysPxe bool = false + this.AlwaysPxe = &alwaysPxe + var hardwareReservationId string = "" + this.HardwareReservationId = &hardwareReservationId + var locked bool = false + this.Locked = &locked + var noSshKeys bool = false + this.NoSshKeys = &noSshKeys + var privateIpv4SubnetSize int32 = 28 + this.PrivateIpv4SubnetSize = &privateIpv4SubnetSize + var publicIpv4SubnetSize int32 = 31 + this.PublicIpv4SubnetSize = &publicIpv4SubnetSize + return &this +} + +// GetHostnames returns the Hostnames field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetHostnames() []string { + if o == nil || IsNil(o.Hostnames) { + var ret []string + return ret + } + return o.Hostnames +} + +// GetHostnamesOk returns a tuple with the Hostnames field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetHostnamesOk() ([]string, bool) { + if o == nil || IsNil(o.Hostnames) { + return nil, false + } + return o.Hostnames, true +} + +// HasHostnames returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasHostnames() bool { + if o != nil && !IsNil(o.Hostnames) { + return true + } + + return false +} + +// SetHostnames gets a reference to the given []string and assigns it to the Hostnames field. +func (o *InstancesBatchCreateInputBatchesInner) SetHostnames(v []string) { + o.Hostnames = v +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetQuantity() int32 { + if o == nil || IsNil(o.Quantity) { + var ret int32 + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetQuantityOk() (*int32, bool) { + if o == nil || IsNil(o.Quantity) { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasQuantity() bool { + if o != nil && !IsNil(o.Quantity) { + return true + } + + return false +} + +// SetQuantity gets a reference to the given int32 and assigns it to the Quantity field. +func (o *InstancesBatchCreateInputBatchesInner) SetQuantity(v int32) { + o.Quantity = &v +} + +// GetMetro returns the Metro field value +func (o *InstancesBatchCreateInputBatchesInner) GetMetro() string { + if o == nil { + var ret string + return ret + } + + return o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetMetroOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metro, true +} + +// SetMetro sets field value +func (o *InstancesBatchCreateInputBatchesInner) SetMetro(v string) { + o.Metro = v +} + +// GetAlwaysPxe returns the AlwaysPxe field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetAlwaysPxe() bool { + if o == nil || IsNil(o.AlwaysPxe) { + var ret bool + return ret + } + return *o.AlwaysPxe +} + +// GetAlwaysPxeOk returns a tuple with the AlwaysPxe field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetAlwaysPxeOk() (*bool, bool) { + if o == nil || IsNil(o.AlwaysPxe) { + return nil, false + } + return o.AlwaysPxe, true +} + +// HasAlwaysPxe returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasAlwaysPxe() bool { + if o != nil && !IsNil(o.AlwaysPxe) { + return true + } + + return false +} + +// SetAlwaysPxe gets a reference to the given bool and assigns it to the AlwaysPxe field. +func (o *InstancesBatchCreateInputBatchesInner) SetAlwaysPxe(v bool) { + o.AlwaysPxe = &v +} + +// GetBillingCycle returns the BillingCycle field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetBillingCycle() DeviceCreateInputBillingCycle { + if o == nil || IsNil(o.BillingCycle) { + var ret DeviceCreateInputBillingCycle + return ret + } + return *o.BillingCycle +} + +// GetBillingCycleOk returns a tuple with the BillingCycle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetBillingCycleOk() (*DeviceCreateInputBillingCycle, bool) { + if o == nil || IsNil(o.BillingCycle) { + return nil, false + } + return o.BillingCycle, true +} + +// HasBillingCycle returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasBillingCycle() bool { + if o != nil && !IsNil(o.BillingCycle) { + return true + } + + return false +} + +// SetBillingCycle gets a reference to the given DeviceCreateInputBillingCycle and assigns it to the BillingCycle field. +func (o *InstancesBatchCreateInputBatchesInner) SetBillingCycle(v DeviceCreateInputBillingCycle) { + o.BillingCycle = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *InstancesBatchCreateInputBatchesInner) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *InstancesBatchCreateInputBatchesInner) SetDescription(v string) { + o.Description = &v +} + +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetFeatures() []string { + if o == nil || IsNil(o.Features) { + var ret []string + return ret + } + return o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetFeaturesOk() ([]string, bool) { + if o == nil || IsNil(o.Features) { + return nil, false + } + return o.Features, true +} + +// HasFeatures returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasFeatures() bool { + if o != nil && !IsNil(o.Features) { + return true + } + + return false +} + +// SetFeatures gets a reference to the given []string and assigns it to the Features field. +func (o *InstancesBatchCreateInputBatchesInner) SetFeatures(v []string) { + o.Features = v +} + +// GetHardwareReservationId returns the HardwareReservationId field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetHardwareReservationId() string { + if o == nil || IsNil(o.HardwareReservationId) { + var ret string + return ret + } + return *o.HardwareReservationId +} + +// GetHardwareReservationIdOk returns a tuple with the HardwareReservationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetHardwareReservationIdOk() (*string, bool) { + if o == nil || IsNil(o.HardwareReservationId) { + return nil, false + } + return o.HardwareReservationId, true +} + +// HasHardwareReservationId returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasHardwareReservationId() bool { + if o != nil && !IsNil(o.HardwareReservationId) { + return true + } + + return false +} + +// SetHardwareReservationId gets a reference to the given string and assigns it to the HardwareReservationId field. +func (o *InstancesBatchCreateInputBatchesInner) SetHardwareReservationId(v string) { + o.HardwareReservationId = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetHostname() string { + if o == nil || IsNil(o.Hostname) { + var ret string + return ret + } + return *o.Hostname +} + +// GetHostnameOk returns a tuple with the Hostname field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetHostnameOk() (*string, bool) { + if o == nil || IsNil(o.Hostname) { + return nil, false + } + return o.Hostname, true +} + +// HasHostname returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasHostname() bool { + if o != nil && !IsNil(o.Hostname) { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *InstancesBatchCreateInputBatchesInner) SetHostname(v string) { + o.Hostname = &v +} + +// GetIpAddresses returns the IpAddresses field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetIpAddresses() []IPAddress { + if o == nil || IsNil(o.IpAddresses) { + var ret []IPAddress + return ret + } + return o.IpAddresses +} + +// GetIpAddressesOk returns a tuple with the IpAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetIpAddressesOk() ([]IPAddress, bool) { + if o == nil || IsNil(o.IpAddresses) { + return nil, false + } + return o.IpAddresses, true +} + +// HasIpAddresses returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasIpAddresses() bool { + if o != nil && !IsNil(o.IpAddresses) { + return true + } + + return false +} + +// SetIpAddresses gets a reference to the given []IPAddress and assigns it to the IpAddresses field. +func (o *InstancesBatchCreateInputBatchesInner) SetIpAddresses(v []IPAddress) { + o.IpAddresses = v +} + +// GetIpxeScriptUrl returns the IpxeScriptUrl field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetIpxeScriptUrl() string { + if o == nil || IsNil(o.IpxeScriptUrl) { + var ret string + return ret + } + return *o.IpxeScriptUrl +} + +// GetIpxeScriptUrlOk returns a tuple with the IpxeScriptUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetIpxeScriptUrlOk() (*string, bool) { + if o == nil || IsNil(o.IpxeScriptUrl) { + return nil, false + } + return o.IpxeScriptUrl, true +} + +// HasIpxeScriptUrl returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasIpxeScriptUrl() bool { + if o != nil && !IsNil(o.IpxeScriptUrl) { + return true + } + + return false +} + +// SetIpxeScriptUrl gets a reference to the given string and assigns it to the IpxeScriptUrl field. +func (o *InstancesBatchCreateInputBatchesInner) SetIpxeScriptUrl(v string) { + o.IpxeScriptUrl = &v +} + +// GetLocked returns the Locked field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetLocked() bool { + if o == nil || IsNil(o.Locked) { + var ret bool + return ret + } + return *o.Locked +} + +// GetLockedOk returns a tuple with the Locked field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetLockedOk() (*bool, bool) { + if o == nil || IsNil(o.Locked) { + return nil, false + } + return o.Locked, true +} + +// HasLocked returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasLocked() bool { + if o != nil && !IsNil(o.Locked) { + return true + } + + return false +} + +// SetLocked gets a reference to the given bool and assigns it to the Locked field. +func (o *InstancesBatchCreateInputBatchesInner) SetLocked(v bool) { + o.Locked = &v +} + +// GetNetworkFrozen returns the NetworkFrozen field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetNetworkFrozen() bool { + if o == nil || IsNil(o.NetworkFrozen) { + var ret bool + return ret + } + return *o.NetworkFrozen +} + +// GetNetworkFrozenOk returns a tuple with the NetworkFrozen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetNetworkFrozenOk() (*bool, bool) { + if o == nil || IsNil(o.NetworkFrozen) { + return nil, false + } + return o.NetworkFrozen, true +} + +// HasNetworkFrozen returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasNetworkFrozen() bool { + if o != nil && !IsNil(o.NetworkFrozen) { + return true + } + + return false +} + +// SetNetworkFrozen gets a reference to the given bool and assigns it to the NetworkFrozen field. +func (o *InstancesBatchCreateInputBatchesInner) SetNetworkFrozen(v bool) { + o.NetworkFrozen = &v +} + +// GetNoSshKeys returns the NoSshKeys field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetNoSshKeys() bool { + if o == nil || IsNil(o.NoSshKeys) { + var ret bool + return ret + } + return *o.NoSshKeys +} + +// GetNoSshKeysOk returns a tuple with the NoSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetNoSshKeysOk() (*bool, bool) { + if o == nil || IsNil(o.NoSshKeys) { + return nil, false + } + return o.NoSshKeys, true +} + +// HasNoSshKeys returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasNoSshKeys() bool { + if o != nil && !IsNil(o.NoSshKeys) { + return true + } + + return false +} + +// SetNoSshKeys gets a reference to the given bool and assigns it to the NoSshKeys field. +func (o *InstancesBatchCreateInputBatchesInner) SetNoSshKeys(v bool) { + o.NoSshKeys = &v +} + +// GetOperatingSystem returns the OperatingSystem field value +func (o *InstancesBatchCreateInputBatchesInner) GetOperatingSystem() string { + if o == nil { + var ret string + return ret + } + + return o.OperatingSystem +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetOperatingSystemOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OperatingSystem, true +} + +// SetOperatingSystem sets field value +func (o *InstancesBatchCreateInputBatchesInner) SetOperatingSystem(v string) { + o.OperatingSystem = v +} + +// GetPlan returns the Plan field value +func (o *InstancesBatchCreateInputBatchesInner) GetPlan() string { + if o == nil { + var ret string + return ret + } + + return o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetPlanOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Plan, true +} + +// SetPlan sets field value +func (o *InstancesBatchCreateInputBatchesInner) SetPlan(v string) { + o.Plan = v +} + +// GetPrivateIpv4SubnetSize returns the PrivateIpv4SubnetSize field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetPrivateIpv4SubnetSize() int32 { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + var ret int32 + return ret + } + return *o.PrivateIpv4SubnetSize +} + +// GetPrivateIpv4SubnetSizeOk returns a tuple with the PrivateIpv4SubnetSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetPrivateIpv4SubnetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + return nil, false + } + return o.PrivateIpv4SubnetSize, true +} + +// HasPrivateIpv4SubnetSize returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasPrivateIpv4SubnetSize() bool { + if o != nil && !IsNil(o.PrivateIpv4SubnetSize) { + return true + } + + return false +} + +// SetPrivateIpv4SubnetSize gets a reference to the given int32 and assigns it to the PrivateIpv4SubnetSize field. +func (o *InstancesBatchCreateInputBatchesInner) SetPrivateIpv4SubnetSize(v int32) { + o.PrivateIpv4SubnetSize = &v +} + +// GetProjectSshKeys returns the ProjectSshKeys field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetProjectSshKeys() []string { + if o == nil || IsNil(o.ProjectSshKeys) { + var ret []string + return ret + } + return o.ProjectSshKeys +} + +// GetProjectSshKeysOk returns a tuple with the ProjectSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetProjectSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.ProjectSshKeys) { + return nil, false + } + return o.ProjectSshKeys, true +} + +// HasProjectSshKeys returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasProjectSshKeys() bool { + if o != nil && !IsNil(o.ProjectSshKeys) { + return true + } + + return false +} + +// SetProjectSshKeys gets a reference to the given []string and assigns it to the ProjectSshKeys field. +func (o *InstancesBatchCreateInputBatchesInner) SetProjectSshKeys(v []string) { + o.ProjectSshKeys = v +} + +// GetPublicIpv4SubnetSize returns the PublicIpv4SubnetSize field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetPublicIpv4SubnetSize() int32 { + if o == nil || IsNil(o.PublicIpv4SubnetSize) { + var ret int32 + return ret + } + return *o.PublicIpv4SubnetSize +} + +// GetPublicIpv4SubnetSizeOk returns a tuple with the PublicIpv4SubnetSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetPublicIpv4SubnetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PublicIpv4SubnetSize) { + return nil, false + } + return o.PublicIpv4SubnetSize, true +} + +// HasPublicIpv4SubnetSize returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasPublicIpv4SubnetSize() bool { + if o != nil && !IsNil(o.PublicIpv4SubnetSize) { + return true + } + + return false +} + +// SetPublicIpv4SubnetSize gets a reference to the given int32 and assigns it to the PublicIpv4SubnetSize field. +func (o *InstancesBatchCreateInputBatchesInner) SetPublicIpv4SubnetSize(v int32) { + o.PublicIpv4SubnetSize = &v +} + +// GetSpotInstance returns the SpotInstance field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetSpotInstance() bool { + if o == nil || IsNil(o.SpotInstance) { + var ret bool + return ret + } + return *o.SpotInstance +} + +// GetSpotInstanceOk returns a tuple with the SpotInstance field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetSpotInstanceOk() (*bool, bool) { + if o == nil || IsNil(o.SpotInstance) { + return nil, false + } + return o.SpotInstance, true +} + +// HasSpotInstance returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasSpotInstance() bool { + if o != nil && !IsNil(o.SpotInstance) { + return true + } + + return false +} + +// SetSpotInstance gets a reference to the given bool and assigns it to the SpotInstance field. +func (o *InstancesBatchCreateInputBatchesInner) SetSpotInstance(v bool) { + o.SpotInstance = &v +} + +// GetSpotPriceMax returns the SpotPriceMax field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetSpotPriceMax() float32 { + if o == nil || IsNil(o.SpotPriceMax) { + var ret float32 + return ret + } + return *o.SpotPriceMax +} + +// GetSpotPriceMaxOk returns a tuple with the SpotPriceMax field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetSpotPriceMaxOk() (*float32, bool) { + if o == nil || IsNil(o.SpotPriceMax) { + return nil, false + } + return o.SpotPriceMax, true +} + +// HasSpotPriceMax returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasSpotPriceMax() bool { + if o != nil && !IsNil(o.SpotPriceMax) { + return true + } + + return false +} + +// SetSpotPriceMax gets a reference to the given float32 and assigns it to the SpotPriceMax field. +func (o *InstancesBatchCreateInputBatchesInner) SetSpotPriceMax(v float32) { + o.SpotPriceMax = &v +} + +// GetSshKeys returns the SshKeys field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetSshKeys() []SSHKeyInput { + if o == nil || IsNil(o.SshKeys) { + var ret []SSHKeyInput + return ret + } + return o.SshKeys +} + +// GetSshKeysOk returns a tuple with the SshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetSshKeysOk() ([]SSHKeyInput, bool) { + if o == nil || IsNil(o.SshKeys) { + return nil, false + } + return o.SshKeys, true +} + +// HasSshKeys returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasSshKeys() bool { + if o != nil && !IsNil(o.SshKeys) { + return true + } + + return false +} + +// SetSshKeys gets a reference to the given []SSHKeyInput and assigns it to the SshKeys field. +func (o *InstancesBatchCreateInputBatchesInner) SetSshKeys(v []SSHKeyInput) { + o.SshKeys = v +} + +// GetStorage returns the Storage field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetStorage() Storage { + if o == nil || IsNil(o.Storage) { + var ret Storage + return ret + } + return *o.Storage +} + +// GetStorageOk returns a tuple with the Storage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetStorageOk() (*Storage, bool) { + if o == nil || IsNil(o.Storage) { + return nil, false + } + return o.Storage, true +} + +// HasStorage returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasStorage() bool { + if o != nil && !IsNil(o.Storage) { + return true + } + + return false +} + +// SetStorage gets a reference to the given Storage and assigns it to the Storage field. +func (o *InstancesBatchCreateInputBatchesInner) SetStorage(v Storage) { + o.Storage = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *InstancesBatchCreateInputBatchesInner) SetTags(v []string) { + o.Tags = v +} + +// GetTerminationTime returns the TerminationTime field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetTerminationTime() time.Time { + if o == nil || IsNil(o.TerminationTime) { + var ret time.Time + return ret + } + return *o.TerminationTime +} + +// GetTerminationTimeOk returns a tuple with the TerminationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetTerminationTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.TerminationTime) { + return nil, false + } + return o.TerminationTime, true +} + +// HasTerminationTime returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasTerminationTime() bool { + if o != nil && !IsNil(o.TerminationTime) { + return true + } + + return false +} + +// SetTerminationTime gets a reference to the given time.Time and assigns it to the TerminationTime field. +func (o *InstancesBatchCreateInputBatchesInner) SetTerminationTime(v time.Time) { + o.TerminationTime = &v +} + +// GetUserSshKeys returns the UserSshKeys field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetUserSshKeys() []string { + if o == nil || IsNil(o.UserSshKeys) { + var ret []string + return ret + } + return o.UserSshKeys +} + +// GetUserSshKeysOk returns a tuple with the UserSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetUserSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.UserSshKeys) { + return nil, false + } + return o.UserSshKeys, true +} + +// HasUserSshKeys returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasUserSshKeys() bool { + if o != nil && !IsNil(o.UserSshKeys) { + return true + } + + return false +} + +// SetUserSshKeys gets a reference to the given []string and assigns it to the UserSshKeys field. +func (o *InstancesBatchCreateInputBatchesInner) SetUserSshKeys(v []string) { + o.UserSshKeys = v +} + +// GetUserdata returns the Userdata field value if set, zero value otherwise. +func (o *InstancesBatchCreateInputBatchesInner) GetUserdata() string { + if o == nil || IsNil(o.Userdata) { + var ret string + return ret + } + return *o.Userdata +} + +// GetUserdataOk returns a tuple with the Userdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstancesBatchCreateInputBatchesInner) GetUserdataOk() (*string, bool) { + if o == nil || IsNil(o.Userdata) { + return nil, false + } + return o.Userdata, true +} + +// HasUserdata returns a boolean if a field has been set. +func (o *InstancesBatchCreateInputBatchesInner) HasUserdata() bool { + if o != nil && !IsNil(o.Userdata) { + return true + } + + return false +} + +// SetUserdata gets a reference to the given string and assigns it to the Userdata field. +func (o *InstancesBatchCreateInputBatchesInner) SetUserdata(v string) { + o.Userdata = &v +} + +// GetFacility returns the Facility field value +// Deprecated +func (o *InstancesBatchCreateInputBatchesInner) GetFacility() []string { + if o == nil { + var ret []string + return ret + } + + return o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *InstancesBatchCreateInputBatchesInner) GetFacilityOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Facility, true +} + +// SetFacility sets field value +// Deprecated +func (o *InstancesBatchCreateInputBatchesInner) SetFacility(v []string) { + o.Facility = v +} + +func (o InstancesBatchCreateInputBatchesInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstancesBatchCreateInputBatchesInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Hostnames) { + toSerialize["hostnames"] = o.Hostnames + } + if !IsNil(o.Quantity) { + toSerialize["quantity"] = o.Quantity + } + toSerialize["metro"] = o.Metro + if !IsNil(o.AlwaysPxe) { + toSerialize["always_pxe"] = o.AlwaysPxe + } + if !IsNil(o.BillingCycle) { + toSerialize["billing_cycle"] = o.BillingCycle + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Features) { + toSerialize["features"] = o.Features + } + if !IsNil(o.HardwareReservationId) { + toSerialize["hardware_reservation_id"] = o.HardwareReservationId + } + if !IsNil(o.Hostname) { + toSerialize["hostname"] = o.Hostname + } + if !IsNil(o.IpAddresses) { + toSerialize["ip_addresses"] = o.IpAddresses + } + if !IsNil(o.IpxeScriptUrl) { + toSerialize["ipxe_script_url"] = o.IpxeScriptUrl + } + if !IsNil(o.Locked) { + toSerialize["locked"] = o.Locked + } + if !IsNil(o.NetworkFrozen) { + toSerialize["network_frozen"] = o.NetworkFrozen + } + if !IsNil(o.NoSshKeys) { + toSerialize["no_ssh_keys"] = o.NoSshKeys + } + toSerialize["operating_system"] = o.OperatingSystem + toSerialize["plan"] = o.Plan + if !IsNil(o.PrivateIpv4SubnetSize) { + toSerialize["private_ipv4_subnet_size"] = o.PrivateIpv4SubnetSize + } + if !IsNil(o.ProjectSshKeys) { + toSerialize["project_ssh_keys"] = o.ProjectSshKeys + } + if !IsNil(o.PublicIpv4SubnetSize) { + toSerialize["public_ipv4_subnet_size"] = o.PublicIpv4SubnetSize + } + if !IsNil(o.SpotInstance) { + toSerialize["spot_instance"] = o.SpotInstance + } + if !IsNil(o.SpotPriceMax) { + toSerialize["spot_price_max"] = o.SpotPriceMax + } + if !IsNil(o.SshKeys) { + toSerialize["ssh_keys"] = o.SshKeys + } + if !IsNil(o.Storage) { + toSerialize["storage"] = o.Storage + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.TerminationTime) { + toSerialize["termination_time"] = o.TerminationTime + } + if !IsNil(o.UserSshKeys) { + toSerialize["user_ssh_keys"] = o.UserSshKeys + } + if !IsNil(o.Userdata) { + toSerialize["userdata"] = o.Userdata + } + toSerialize["facility"] = o.Facility + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstancesBatchCreateInputBatchesInner) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "metro", + "operating_system", + "plan", + "facility", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varInstancesBatchCreateInputBatchesInner := _InstancesBatchCreateInputBatchesInner{} + + err = json.Unmarshal(data, &varInstancesBatchCreateInputBatchesInner) + + if err != nil { + return err + } + + *o = InstancesBatchCreateInputBatchesInner(varInstancesBatchCreateInputBatchesInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "hostnames") + delete(additionalProperties, "quantity") + delete(additionalProperties, "metro") + delete(additionalProperties, "always_pxe") + delete(additionalProperties, "billing_cycle") + delete(additionalProperties, "customdata") + delete(additionalProperties, "description") + delete(additionalProperties, "features") + delete(additionalProperties, "hardware_reservation_id") + delete(additionalProperties, "hostname") + delete(additionalProperties, "ip_addresses") + delete(additionalProperties, "ipxe_script_url") + delete(additionalProperties, "locked") + delete(additionalProperties, "network_frozen") + delete(additionalProperties, "no_ssh_keys") + delete(additionalProperties, "operating_system") + delete(additionalProperties, "plan") + delete(additionalProperties, "private_ipv4_subnet_size") + delete(additionalProperties, "project_ssh_keys") + delete(additionalProperties, "public_ipv4_subnet_size") + delete(additionalProperties, "spot_instance") + delete(additionalProperties, "spot_price_max") + delete(additionalProperties, "ssh_keys") + delete(additionalProperties, "storage") + delete(additionalProperties, "tags") + delete(additionalProperties, "termination_time") + delete(additionalProperties, "user_ssh_keys") + delete(additionalProperties, "userdata") + delete(additionalProperties, "facility") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstancesBatchCreateInputBatchesInner struct { + value *InstancesBatchCreateInputBatchesInner + isSet bool +} + +func (v NullableInstancesBatchCreateInputBatchesInner) Get() *InstancesBatchCreateInputBatchesInner { + return v.value +} + +func (v *NullableInstancesBatchCreateInputBatchesInner) Set(val *InstancesBatchCreateInputBatchesInner) { + v.value = val + v.isSet = true +} + +func (v NullableInstancesBatchCreateInputBatchesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableInstancesBatchCreateInputBatchesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstancesBatchCreateInputBatchesInner(val *InstancesBatchCreateInputBatchesInner) *NullableInstancesBatchCreateInputBatchesInner { + return &NullableInstancesBatchCreateInputBatchesInner{value: val, isSet: true} +} + +func (v NullableInstancesBatchCreateInputBatchesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstancesBatchCreateInputBatchesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection.go new file mode 100644 index 00000000..12112b09 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection.go @@ -0,0 +1,825 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the Interconnection type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Interconnection{} + +// Interconnection struct for Interconnection +type Interconnection struct { + ContactEmail *string `json:"contact_email,omitempty"` + Description *string `json:"description,omitempty"` + Facility *Href `json:"facility,omitempty"` + Id *string `json:"id,omitempty"` + Metro *Metro `json:"metro,omitempty"` + Mode *InterconnectionMode `json:"mode,omitempty"` + Name *string `json:"name,omitempty"` + Organization *Href `json:"organization,omitempty"` + // For Fabric VCs, these represent Virtual Port(s) created for the interconnection. For dedicated interconnections, these represent the Dedicated Port(s). + Ports []InterconnectionPort `json:"ports,omitempty"` + Redundancy *InterconnectionRedundancy `json:"redundancy,omitempty"` + // For Fabric VCs (Metal Billed), this will show details of the A-Side service tokens issued for the interconnection. For Fabric VCs (Fabric Billed), this will show the details of the Z-Side service tokens issued for the interconnection. Dedicated interconnections will not have any service tokens issued. There will be one per interconnection, so for redundant interconnections, there should be two service tokens issued. + ServiceTokens []FabricServiceToken `json:"service_tokens,omitempty"` + // For interconnections on Dedicated Ports and shared connections, this represents the interconnection's speed in bps. For Fabric VCs, this field refers to the maximum speed of the interconnection in bps. This value will default to 10Gbps for Fabric VCs (Fabric Billed). + Speed *int64 `json:"speed,omitempty"` + Status *string `json:"status,omitempty"` + Tags []string `json:"tags,omitempty"` + // This token is used for shared interconnections to be used as the Fabric Token. This field is entirely deprecated. + Token *string `json:"token,omitempty"` + Type *InterconnectionType `json:"type,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + RequestedBy *Href `json:"requested_by,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Interconnection Interconnection + +// NewInterconnection instantiates a new Interconnection object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInterconnection() *Interconnection { + this := Interconnection{} + return &this +} + +// NewInterconnectionWithDefaults instantiates a new Interconnection object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInterconnectionWithDefaults() *Interconnection { + this := Interconnection{} + return &this +} + +// GetContactEmail returns the ContactEmail field value if set, zero value otherwise. +func (o *Interconnection) GetContactEmail() string { + if o == nil || IsNil(o.ContactEmail) { + var ret string + return ret + } + return *o.ContactEmail +} + +// GetContactEmailOk returns a tuple with the ContactEmail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetContactEmailOk() (*string, bool) { + if o == nil || IsNil(o.ContactEmail) { + return nil, false + } + return o.ContactEmail, true +} + +// HasContactEmail returns a boolean if a field has been set. +func (o *Interconnection) HasContactEmail() bool { + if o != nil && !IsNil(o.ContactEmail) { + return true + } + + return false +} + +// SetContactEmail gets a reference to the given string and assigns it to the ContactEmail field. +func (o *Interconnection) SetContactEmail(v string) { + o.ContactEmail = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Interconnection) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Interconnection) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Interconnection) SetDescription(v string) { + o.Description = &v +} + +// GetFacility returns the Facility field value if set, zero value otherwise. +func (o *Interconnection) GetFacility() Href { + if o == nil || IsNil(o.Facility) { + var ret Href + return ret + } + return *o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetFacilityOk() (*Href, bool) { + if o == nil || IsNil(o.Facility) { + return nil, false + } + return o.Facility, true +} + +// HasFacility returns a boolean if a field has been set. +func (o *Interconnection) HasFacility() bool { + if o != nil && !IsNil(o.Facility) { + return true + } + + return false +} + +// SetFacility gets a reference to the given Href and assigns it to the Facility field. +func (o *Interconnection) SetFacility(v Href) { + o.Facility = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Interconnection) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Interconnection) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Interconnection) SetId(v string) { + o.Id = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *Interconnection) GetMetro() Metro { + if o == nil || IsNil(o.Metro) { + var ret Metro + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetMetroOk() (*Metro, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *Interconnection) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given Metro and assigns it to the Metro field. +func (o *Interconnection) SetMetro(v Metro) { + o.Metro = &v +} + +// GetMode returns the Mode field value if set, zero value otherwise. +func (o *Interconnection) GetMode() InterconnectionMode { + if o == nil || IsNil(o.Mode) { + var ret InterconnectionMode + return ret + } + return *o.Mode +} + +// GetModeOk returns a tuple with the Mode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetModeOk() (*InterconnectionMode, bool) { + if o == nil || IsNil(o.Mode) { + return nil, false + } + return o.Mode, true +} + +// HasMode returns a boolean if a field has been set. +func (o *Interconnection) HasMode() bool { + if o != nil && !IsNil(o.Mode) { + return true + } + + return false +} + +// SetMode gets a reference to the given InterconnectionMode and assigns it to the Mode field. +func (o *Interconnection) SetMode(v InterconnectionMode) { + o.Mode = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Interconnection) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Interconnection) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Interconnection) SetName(v string) { + o.Name = &v +} + +// GetOrganization returns the Organization field value if set, zero value otherwise. +func (o *Interconnection) GetOrganization() Href { + if o == nil || IsNil(o.Organization) { + var ret Href + return ret + } + return *o.Organization +} + +// GetOrganizationOk returns a tuple with the Organization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetOrganizationOk() (*Href, bool) { + if o == nil || IsNil(o.Organization) { + return nil, false + } + return o.Organization, true +} + +// HasOrganization returns a boolean if a field has been set. +func (o *Interconnection) HasOrganization() bool { + if o != nil && !IsNil(o.Organization) { + return true + } + + return false +} + +// SetOrganization gets a reference to the given Href and assigns it to the Organization field. +func (o *Interconnection) SetOrganization(v Href) { + o.Organization = &v +} + +// GetPorts returns the Ports field value if set, zero value otherwise. +func (o *Interconnection) GetPorts() []InterconnectionPort { + if o == nil || IsNil(o.Ports) { + var ret []InterconnectionPort + return ret + } + return o.Ports +} + +// GetPortsOk returns a tuple with the Ports field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetPortsOk() ([]InterconnectionPort, bool) { + if o == nil || IsNil(o.Ports) { + return nil, false + } + return o.Ports, true +} + +// HasPorts returns a boolean if a field has been set. +func (o *Interconnection) HasPorts() bool { + if o != nil && !IsNil(o.Ports) { + return true + } + + return false +} + +// SetPorts gets a reference to the given []InterconnectionPort and assigns it to the Ports field. +func (o *Interconnection) SetPorts(v []InterconnectionPort) { + o.Ports = v +} + +// GetRedundancy returns the Redundancy field value if set, zero value otherwise. +func (o *Interconnection) GetRedundancy() InterconnectionRedundancy { + if o == nil || IsNil(o.Redundancy) { + var ret InterconnectionRedundancy + return ret + } + return *o.Redundancy +} + +// GetRedundancyOk returns a tuple with the Redundancy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetRedundancyOk() (*InterconnectionRedundancy, bool) { + if o == nil || IsNil(o.Redundancy) { + return nil, false + } + return o.Redundancy, true +} + +// HasRedundancy returns a boolean if a field has been set. +func (o *Interconnection) HasRedundancy() bool { + if o != nil && !IsNil(o.Redundancy) { + return true + } + + return false +} + +// SetRedundancy gets a reference to the given InterconnectionRedundancy and assigns it to the Redundancy field. +func (o *Interconnection) SetRedundancy(v InterconnectionRedundancy) { + o.Redundancy = &v +} + +// GetServiceTokens returns the ServiceTokens field value if set, zero value otherwise. +func (o *Interconnection) GetServiceTokens() []FabricServiceToken { + if o == nil || IsNil(o.ServiceTokens) { + var ret []FabricServiceToken + return ret + } + return o.ServiceTokens +} + +// GetServiceTokensOk returns a tuple with the ServiceTokens field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetServiceTokensOk() ([]FabricServiceToken, bool) { + if o == nil || IsNil(o.ServiceTokens) { + return nil, false + } + return o.ServiceTokens, true +} + +// HasServiceTokens returns a boolean if a field has been set. +func (o *Interconnection) HasServiceTokens() bool { + if o != nil && !IsNil(o.ServiceTokens) { + return true + } + + return false +} + +// SetServiceTokens gets a reference to the given []FabricServiceToken and assigns it to the ServiceTokens field. +func (o *Interconnection) SetServiceTokens(v []FabricServiceToken) { + o.ServiceTokens = v +} + +// GetSpeed returns the Speed field value if set, zero value otherwise. +func (o *Interconnection) GetSpeed() int64 { + if o == nil || IsNil(o.Speed) { + var ret int64 + return ret + } + return *o.Speed +} + +// GetSpeedOk returns a tuple with the Speed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetSpeedOk() (*int64, bool) { + if o == nil || IsNil(o.Speed) { + return nil, false + } + return o.Speed, true +} + +// HasSpeed returns a boolean if a field has been set. +func (o *Interconnection) HasSpeed() bool { + if o != nil && !IsNil(o.Speed) { + return true + } + + return false +} + +// SetSpeed gets a reference to the given int64 and assigns it to the Speed field. +func (o *Interconnection) SetSpeed(v int64) { + o.Speed = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Interconnection) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Interconnection) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Interconnection) SetStatus(v string) { + o.Status = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Interconnection) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *Interconnection) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *Interconnection) SetTags(v []string) { + o.Tags = v +} + +// GetToken returns the Token field value if set, zero value otherwise. +func (o *Interconnection) GetToken() string { + if o == nil || IsNil(o.Token) { + var ret string + return ret + } + return *o.Token +} + +// GetTokenOk returns a tuple with the Token field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetTokenOk() (*string, bool) { + if o == nil || IsNil(o.Token) { + return nil, false + } + return o.Token, true +} + +// HasToken returns a boolean if a field has been set. +func (o *Interconnection) HasToken() bool { + if o != nil && !IsNil(o.Token) { + return true + } + + return false +} + +// SetToken gets a reference to the given string and assigns it to the Token field. +func (o *Interconnection) SetToken(v string) { + o.Token = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Interconnection) GetType() InterconnectionType { + if o == nil || IsNil(o.Type) { + var ret InterconnectionType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetTypeOk() (*InterconnectionType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Interconnection) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given InterconnectionType and assigns it to the Type field. +func (o *Interconnection) SetType(v InterconnectionType) { + o.Type = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Interconnection) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Interconnection) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Interconnection) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Interconnection) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Interconnection) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Interconnection) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetRequestedBy returns the RequestedBy field value if set, zero value otherwise. +func (o *Interconnection) GetRequestedBy() Href { + if o == nil || IsNil(o.RequestedBy) { + var ret Href + return ret + } + return *o.RequestedBy +} + +// GetRequestedByOk returns a tuple with the RequestedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Interconnection) GetRequestedByOk() (*Href, bool) { + if o == nil || IsNil(o.RequestedBy) { + return nil, false + } + return o.RequestedBy, true +} + +// HasRequestedBy returns a boolean if a field has been set. +func (o *Interconnection) HasRequestedBy() bool { + if o != nil && !IsNil(o.RequestedBy) { + return true + } + + return false +} + +// SetRequestedBy gets a reference to the given Href and assigns it to the RequestedBy field. +func (o *Interconnection) SetRequestedBy(v Href) { + o.RequestedBy = &v +} + +func (o Interconnection) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Interconnection) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ContactEmail) { + toSerialize["contact_email"] = o.ContactEmail + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Facility) { + toSerialize["facility"] = o.Facility + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.Mode) { + toSerialize["mode"] = o.Mode + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Organization) { + toSerialize["organization"] = o.Organization + } + if !IsNil(o.Ports) { + toSerialize["ports"] = o.Ports + } + if !IsNil(o.Redundancy) { + toSerialize["redundancy"] = o.Redundancy + } + if !IsNil(o.ServiceTokens) { + toSerialize["service_tokens"] = o.ServiceTokens + } + if !IsNil(o.Speed) { + toSerialize["speed"] = o.Speed + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Token) { + toSerialize["token"] = o.Token + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.RequestedBy) { + toSerialize["requested_by"] = o.RequestedBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Interconnection) UnmarshalJSON(data []byte) (err error) { + varInterconnection := _Interconnection{} + + err = json.Unmarshal(data, &varInterconnection) + + if err != nil { + return err + } + + *o = Interconnection(varInterconnection) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "contact_email") + delete(additionalProperties, "description") + delete(additionalProperties, "facility") + delete(additionalProperties, "id") + delete(additionalProperties, "metro") + delete(additionalProperties, "mode") + delete(additionalProperties, "name") + delete(additionalProperties, "organization") + delete(additionalProperties, "ports") + delete(additionalProperties, "redundancy") + delete(additionalProperties, "service_tokens") + delete(additionalProperties, "speed") + delete(additionalProperties, "status") + delete(additionalProperties, "tags") + delete(additionalProperties, "token") + delete(additionalProperties, "type") + delete(additionalProperties, "created_at") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "requested_by") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInterconnection struct { + value *Interconnection + isSet bool +} + +func (v NullableInterconnection) Get() *Interconnection { + return v.value +} + +func (v *NullableInterconnection) Set(val *Interconnection) { + v.value = val + v.isSet = true +} + +func (v NullableInterconnection) IsSet() bool { + return v.isSet +} + +func (v *NullableInterconnection) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInterconnection(val *Interconnection) *NullableInterconnection { + return &NullableInterconnection{value: val, isSet: true} +} + +func (v NullableInterconnection) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInterconnection) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_list.go new file mode 100644 index 00000000..cff0d8d7 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_list.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the InterconnectionList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InterconnectionList{} + +// InterconnectionList struct for InterconnectionList +type InterconnectionList struct { + Interconnections []Interconnection `json:"interconnections,omitempty"` + Meta *Meta `json:"meta,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InterconnectionList InterconnectionList + +// NewInterconnectionList instantiates a new InterconnectionList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInterconnectionList() *InterconnectionList { + this := InterconnectionList{} + return &this +} + +// NewInterconnectionListWithDefaults instantiates a new InterconnectionList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInterconnectionListWithDefaults() *InterconnectionList { + this := InterconnectionList{} + return &this +} + +// GetInterconnections returns the Interconnections field value if set, zero value otherwise. +func (o *InterconnectionList) GetInterconnections() []Interconnection { + if o == nil || IsNil(o.Interconnections) { + var ret []Interconnection + return ret + } + return o.Interconnections +} + +// GetInterconnectionsOk returns a tuple with the Interconnections field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionList) GetInterconnectionsOk() ([]Interconnection, bool) { + if o == nil || IsNil(o.Interconnections) { + return nil, false + } + return o.Interconnections, true +} + +// HasInterconnections returns a boolean if a field has been set. +func (o *InterconnectionList) HasInterconnections() bool { + if o != nil && !IsNil(o.Interconnections) { + return true + } + + return false +} + +// SetInterconnections gets a reference to the given []Interconnection and assigns it to the Interconnections field. +func (o *InterconnectionList) SetInterconnections(v []Interconnection) { + o.Interconnections = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *InterconnectionList) GetMeta() Meta { + if o == nil || IsNil(o.Meta) { + var ret Meta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionList) GetMetaOk() (*Meta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *InterconnectionList) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given Meta and assigns it to the Meta field. +func (o *InterconnectionList) SetMeta(v Meta) { + o.Meta = &v +} + +func (o InterconnectionList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InterconnectionList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Interconnections) { + toSerialize["interconnections"] = o.Interconnections + } + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InterconnectionList) UnmarshalJSON(data []byte) (err error) { + varInterconnectionList := _InterconnectionList{} + + err = json.Unmarshal(data, &varInterconnectionList) + + if err != nil { + return err + } + + *o = InterconnectionList(varInterconnectionList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "interconnections") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInterconnectionList struct { + value *InterconnectionList + isSet bool +} + +func (v NullableInterconnectionList) Get() *InterconnectionList { + return v.value +} + +func (v *NullableInterconnectionList) Set(val *InterconnectionList) { + v.value = val + v.isSet = true +} + +func (v NullableInterconnectionList) IsSet() bool { + return v.isSet +} + +func (v *NullableInterconnectionList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInterconnectionList(val *InterconnectionList) *NullableInterconnectionList { + return &NullableInterconnectionList{value: val, isSet: true} +} + +func (v NullableInterconnectionList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInterconnectionList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_mode.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_mode.go new file mode 100644 index 00000000..e1d52d5e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_mode.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// InterconnectionMode The mode of the interconnection (only relevant to Dedicated Ports). Shared connections won't have this field. Can be either 'standard' or 'tunnel'. The default mode of an interconnection on a Dedicated Port is 'standard'. The mode can only be changed when there are no associated virtual circuits on the interconnection. In tunnel mode, an 802.1q tunnel is added to a port to send/receive double tagged packets from server instances. +type InterconnectionMode string + +// List of Interconnection_mode +const ( + INTERCONNECTIONMODE_STANDARD InterconnectionMode = "standard" + INTERCONNECTIONMODE_TUNNEL InterconnectionMode = "tunnel" +) + +// All allowed values of InterconnectionMode enum +var AllowedInterconnectionModeEnumValues = []InterconnectionMode{ + "standard", + "tunnel", +} + +func (v *InterconnectionMode) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := InterconnectionMode(value) + for _, existing := range AllowedInterconnectionModeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InterconnectionMode", value) +} + +// NewInterconnectionModeFromValue returns a pointer to a valid InterconnectionMode +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInterconnectionModeFromValue(v string) (*InterconnectionMode, error) { + ev := InterconnectionMode(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InterconnectionMode: valid values are %v", v, AllowedInterconnectionModeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InterconnectionMode) IsValid() bool { + for _, existing := range AllowedInterconnectionModeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Interconnection_mode value +func (v InterconnectionMode) Ptr() *InterconnectionMode { + return &v +} + +type NullableInterconnectionMode struct { + value *InterconnectionMode + isSet bool +} + +func (v NullableInterconnectionMode) Get() *InterconnectionMode { + return v.value +} + +func (v *NullableInterconnectionMode) Set(val *InterconnectionMode) { + v.value = val + v.isSet = true +} + +func (v NullableInterconnectionMode) IsSet() bool { + return v.isSet +} + +func (v *NullableInterconnectionMode) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInterconnectionMode(val *InterconnectionMode) *NullableInterconnectionMode { + return &NullableInterconnectionMode{value: val, isSet: true} +} + +func (v NullableInterconnectionMode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInterconnectionMode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port.go new file mode 100644 index 00000000..aaff12a9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port.go @@ -0,0 +1,488 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the InterconnectionPort type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InterconnectionPort{} + +// InterconnectionPort struct for InterconnectionPort +type InterconnectionPort struct { + Id *string `json:"id,omitempty"` + Organization *Href `json:"organization,omitempty"` + Role *InterconnectionPortRole `json:"role,omitempty"` + Status *InterconnectionPortStatus `json:"status,omitempty"` + // A switch 'short ID' + SwitchId *string `json:"switch_id,omitempty"` + VirtualCircuits []VirtualCircuit `json:"virtual_circuits,omitempty"` + Name *string `json:"name,omitempty"` + Speed *int64 `json:"speed,omitempty"` + LinkStatus *string `json:"link_status,omitempty"` + Href *string `json:"href,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InterconnectionPort InterconnectionPort + +// NewInterconnectionPort instantiates a new InterconnectionPort object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInterconnectionPort() *InterconnectionPort { + this := InterconnectionPort{} + return &this +} + +// NewInterconnectionPortWithDefaults instantiates a new InterconnectionPort object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInterconnectionPortWithDefaults() *InterconnectionPort { + this := InterconnectionPort{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *InterconnectionPort) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionPort) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *InterconnectionPort) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *InterconnectionPort) SetId(v string) { + o.Id = &v +} + +// GetOrganization returns the Organization field value if set, zero value otherwise. +func (o *InterconnectionPort) GetOrganization() Href { + if o == nil || IsNil(o.Organization) { + var ret Href + return ret + } + return *o.Organization +} + +// GetOrganizationOk returns a tuple with the Organization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionPort) GetOrganizationOk() (*Href, bool) { + if o == nil || IsNil(o.Organization) { + return nil, false + } + return o.Organization, true +} + +// HasOrganization returns a boolean if a field has been set. +func (o *InterconnectionPort) HasOrganization() bool { + if o != nil && !IsNil(o.Organization) { + return true + } + + return false +} + +// SetOrganization gets a reference to the given Href and assigns it to the Organization field. +func (o *InterconnectionPort) SetOrganization(v Href) { + o.Organization = &v +} + +// GetRole returns the Role field value if set, zero value otherwise. +func (o *InterconnectionPort) GetRole() InterconnectionPortRole { + if o == nil || IsNil(o.Role) { + var ret InterconnectionPortRole + return ret + } + return *o.Role +} + +// GetRoleOk returns a tuple with the Role field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionPort) GetRoleOk() (*InterconnectionPortRole, bool) { + if o == nil || IsNil(o.Role) { + return nil, false + } + return o.Role, true +} + +// HasRole returns a boolean if a field has been set. +func (o *InterconnectionPort) HasRole() bool { + if o != nil && !IsNil(o.Role) { + return true + } + + return false +} + +// SetRole gets a reference to the given InterconnectionPortRole and assigns it to the Role field. +func (o *InterconnectionPort) SetRole(v InterconnectionPortRole) { + o.Role = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *InterconnectionPort) GetStatus() InterconnectionPortStatus { + if o == nil || IsNil(o.Status) { + var ret InterconnectionPortStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionPort) GetStatusOk() (*InterconnectionPortStatus, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *InterconnectionPort) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given InterconnectionPortStatus and assigns it to the Status field. +func (o *InterconnectionPort) SetStatus(v InterconnectionPortStatus) { + o.Status = &v +} + +// GetSwitchId returns the SwitchId field value if set, zero value otherwise. +func (o *InterconnectionPort) GetSwitchId() string { + if o == nil || IsNil(o.SwitchId) { + var ret string + return ret + } + return *o.SwitchId +} + +// GetSwitchIdOk returns a tuple with the SwitchId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionPort) GetSwitchIdOk() (*string, bool) { + if o == nil || IsNil(o.SwitchId) { + return nil, false + } + return o.SwitchId, true +} + +// HasSwitchId returns a boolean if a field has been set. +func (o *InterconnectionPort) HasSwitchId() bool { + if o != nil && !IsNil(o.SwitchId) { + return true + } + + return false +} + +// SetSwitchId gets a reference to the given string and assigns it to the SwitchId field. +func (o *InterconnectionPort) SetSwitchId(v string) { + o.SwitchId = &v +} + +// GetVirtualCircuits returns the VirtualCircuits field value if set, zero value otherwise. +func (o *InterconnectionPort) GetVirtualCircuits() []VirtualCircuit { + if o == nil || IsNil(o.VirtualCircuits) { + var ret []VirtualCircuit + return ret + } + return o.VirtualCircuits +} + +// GetVirtualCircuitsOk returns a tuple with the VirtualCircuits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionPort) GetVirtualCircuitsOk() ([]VirtualCircuit, bool) { + if o == nil || IsNil(o.VirtualCircuits) { + return nil, false + } + return o.VirtualCircuits, true +} + +// HasVirtualCircuits returns a boolean if a field has been set. +func (o *InterconnectionPort) HasVirtualCircuits() bool { + if o != nil && !IsNil(o.VirtualCircuits) { + return true + } + + return false +} + +// SetVirtualCircuits gets a reference to the given []VirtualCircuit and assigns it to the VirtualCircuits field. +func (o *InterconnectionPort) SetVirtualCircuits(v []VirtualCircuit) { + o.VirtualCircuits = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *InterconnectionPort) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionPort) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *InterconnectionPort) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *InterconnectionPort) SetName(v string) { + o.Name = &v +} + +// GetSpeed returns the Speed field value if set, zero value otherwise. +func (o *InterconnectionPort) GetSpeed() int64 { + if o == nil || IsNil(o.Speed) { + var ret int64 + return ret + } + return *o.Speed +} + +// GetSpeedOk returns a tuple with the Speed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionPort) GetSpeedOk() (*int64, bool) { + if o == nil || IsNil(o.Speed) { + return nil, false + } + return o.Speed, true +} + +// HasSpeed returns a boolean if a field has been set. +func (o *InterconnectionPort) HasSpeed() bool { + if o != nil && !IsNil(o.Speed) { + return true + } + + return false +} + +// SetSpeed gets a reference to the given int64 and assigns it to the Speed field. +func (o *InterconnectionPort) SetSpeed(v int64) { + o.Speed = &v +} + +// GetLinkStatus returns the LinkStatus field value if set, zero value otherwise. +func (o *InterconnectionPort) GetLinkStatus() string { + if o == nil || IsNil(o.LinkStatus) { + var ret string + return ret + } + return *o.LinkStatus +} + +// GetLinkStatusOk returns a tuple with the LinkStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionPort) GetLinkStatusOk() (*string, bool) { + if o == nil || IsNil(o.LinkStatus) { + return nil, false + } + return o.LinkStatus, true +} + +// HasLinkStatus returns a boolean if a field has been set. +func (o *InterconnectionPort) HasLinkStatus() bool { + if o != nil && !IsNil(o.LinkStatus) { + return true + } + + return false +} + +// SetLinkStatus gets a reference to the given string and assigns it to the LinkStatus field. +func (o *InterconnectionPort) SetLinkStatus(v string) { + o.LinkStatus = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *InterconnectionPort) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionPort) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *InterconnectionPort) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *InterconnectionPort) SetHref(v string) { + o.Href = &v +} + +func (o InterconnectionPort) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InterconnectionPort) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Organization) { + toSerialize["organization"] = o.Organization + } + if !IsNil(o.Role) { + toSerialize["role"] = o.Role + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.SwitchId) { + toSerialize["switch_id"] = o.SwitchId + } + if !IsNil(o.VirtualCircuits) { + toSerialize["virtual_circuits"] = o.VirtualCircuits + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Speed) { + toSerialize["speed"] = o.Speed + } + if !IsNil(o.LinkStatus) { + toSerialize["link_status"] = o.LinkStatus + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InterconnectionPort) UnmarshalJSON(data []byte) (err error) { + varInterconnectionPort := _InterconnectionPort{} + + err = json.Unmarshal(data, &varInterconnectionPort) + + if err != nil { + return err + } + + *o = InterconnectionPort(varInterconnectionPort) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "organization") + delete(additionalProperties, "role") + delete(additionalProperties, "status") + delete(additionalProperties, "switch_id") + delete(additionalProperties, "virtual_circuits") + delete(additionalProperties, "name") + delete(additionalProperties, "speed") + delete(additionalProperties, "link_status") + delete(additionalProperties, "href") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInterconnectionPort struct { + value *InterconnectionPort + isSet bool +} + +func (v NullableInterconnectionPort) Get() *InterconnectionPort { + return v.value +} + +func (v *NullableInterconnectionPort) Set(val *InterconnectionPort) { + v.value = val + v.isSet = true +} + +func (v NullableInterconnectionPort) IsSet() bool { + return v.isSet +} + +func (v *NullableInterconnectionPort) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInterconnectionPort(val *InterconnectionPort) *NullableInterconnectionPort { + return &NullableInterconnectionPort{value: val, isSet: true} +} + +func (v NullableInterconnectionPort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInterconnectionPort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_list.go new file mode 100644 index 00000000..fe8a250f --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the InterconnectionPortList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InterconnectionPortList{} + +// InterconnectionPortList struct for InterconnectionPortList +type InterconnectionPortList struct { + Ports []InterconnectionPort `json:"ports,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InterconnectionPortList InterconnectionPortList + +// NewInterconnectionPortList instantiates a new InterconnectionPortList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInterconnectionPortList() *InterconnectionPortList { + this := InterconnectionPortList{} + return &this +} + +// NewInterconnectionPortListWithDefaults instantiates a new InterconnectionPortList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInterconnectionPortListWithDefaults() *InterconnectionPortList { + this := InterconnectionPortList{} + return &this +} + +// GetPorts returns the Ports field value if set, zero value otherwise. +func (o *InterconnectionPortList) GetPorts() []InterconnectionPort { + if o == nil || IsNil(o.Ports) { + var ret []InterconnectionPort + return ret + } + return o.Ports +} + +// GetPortsOk returns a tuple with the Ports field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionPortList) GetPortsOk() ([]InterconnectionPort, bool) { + if o == nil || IsNil(o.Ports) { + return nil, false + } + return o.Ports, true +} + +// HasPorts returns a boolean if a field has been set. +func (o *InterconnectionPortList) HasPorts() bool { + if o != nil && !IsNil(o.Ports) { + return true + } + + return false +} + +// SetPorts gets a reference to the given []InterconnectionPort and assigns it to the Ports field. +func (o *InterconnectionPortList) SetPorts(v []InterconnectionPort) { + o.Ports = v +} + +func (o InterconnectionPortList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InterconnectionPortList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Ports) { + toSerialize["ports"] = o.Ports + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InterconnectionPortList) UnmarshalJSON(data []byte) (err error) { + varInterconnectionPortList := _InterconnectionPortList{} + + err = json.Unmarshal(data, &varInterconnectionPortList) + + if err != nil { + return err + } + + *o = InterconnectionPortList(varInterconnectionPortList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ports") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInterconnectionPortList struct { + value *InterconnectionPortList + isSet bool +} + +func (v NullableInterconnectionPortList) Get() *InterconnectionPortList { + return v.value +} + +func (v *NullableInterconnectionPortList) Set(val *InterconnectionPortList) { + v.value = val + v.isSet = true +} + +func (v NullableInterconnectionPortList) IsSet() bool { + return v.isSet +} + +func (v *NullableInterconnectionPortList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInterconnectionPortList(val *InterconnectionPortList) *NullableInterconnectionPortList { + return &NullableInterconnectionPortList{value: val, isSet: true} +} + +func (v NullableInterconnectionPortList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInterconnectionPortList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_role.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_role.go new file mode 100644 index 00000000..290c189e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_role.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// InterconnectionPortRole Either 'primary' or 'secondary'. +type InterconnectionPortRole string + +// List of InterconnectionPort_role +const ( + INTERCONNECTIONPORTROLE_PRIMARY InterconnectionPortRole = "primary" + INTERCONNECTIONPORTROLE_SECONDARY InterconnectionPortRole = "secondary" +) + +// All allowed values of InterconnectionPortRole enum +var AllowedInterconnectionPortRoleEnumValues = []InterconnectionPortRole{ + "primary", + "secondary", +} + +func (v *InterconnectionPortRole) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := InterconnectionPortRole(value) + for _, existing := range AllowedInterconnectionPortRoleEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InterconnectionPortRole", value) +} + +// NewInterconnectionPortRoleFromValue returns a pointer to a valid InterconnectionPortRole +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInterconnectionPortRoleFromValue(v string) (*InterconnectionPortRole, error) { + ev := InterconnectionPortRole(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InterconnectionPortRole: valid values are %v", v, AllowedInterconnectionPortRoleEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InterconnectionPortRole) IsValid() bool { + for _, existing := range AllowedInterconnectionPortRoleEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to InterconnectionPort_role value +func (v InterconnectionPortRole) Ptr() *InterconnectionPortRole { + return &v +} + +type NullableInterconnectionPortRole struct { + value *InterconnectionPortRole + isSet bool +} + +func (v NullableInterconnectionPortRole) Get() *InterconnectionPortRole { + return v.value +} + +func (v *NullableInterconnectionPortRole) Set(val *InterconnectionPortRole) { + v.value = val + v.isSet = true +} + +func (v NullableInterconnectionPortRole) IsSet() bool { + return v.isSet +} + +func (v *NullableInterconnectionPortRole) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInterconnectionPortRole(val *InterconnectionPortRole) *NullableInterconnectionPortRole { + return &NullableInterconnectionPortRole{value: val, isSet: true} +} + +func (v NullableInterconnectionPortRole) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInterconnectionPortRole) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_status.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_status.go new file mode 100644 index 00000000..ddc6bb1e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_port_status.go @@ -0,0 +1,117 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// InterconnectionPortStatus For both Fabric VCs and Dedicated Ports, this will be 'requested' on creation and 'deleting' on deletion. Once the Fabric VC has found its corresponding Fabric connection, this will turn to 'active'. For Dedicated Ports, once the dedicated port is associated, this will also turn to 'active'. For Fabric VCs, this can turn into an 'expired' state if the service token associated is expired. +type InterconnectionPortStatus string + +// List of InterconnectionPort_status +const ( + INTERCONNECTIONPORTSTATUS_REQUESTED InterconnectionPortStatus = "requested" + INTERCONNECTIONPORTSTATUS_ACTIVE InterconnectionPortStatus = "active" + INTERCONNECTIONPORTSTATUS_DELETING InterconnectionPortStatus = "deleting" + INTERCONNECTIONPORTSTATUS_EXPIRED InterconnectionPortStatus = "expired" + INTERCONNECTIONPORTSTATUS_DELETE_FAILED InterconnectionPortStatus = "delete_failed" +) + +// All allowed values of InterconnectionPortStatus enum +var AllowedInterconnectionPortStatusEnumValues = []InterconnectionPortStatus{ + "requested", + "active", + "deleting", + "expired", + "delete_failed", +} + +func (v *InterconnectionPortStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := InterconnectionPortStatus(value) + for _, existing := range AllowedInterconnectionPortStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InterconnectionPortStatus", value) +} + +// NewInterconnectionPortStatusFromValue returns a pointer to a valid InterconnectionPortStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInterconnectionPortStatusFromValue(v string) (*InterconnectionPortStatus, error) { + ev := InterconnectionPortStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InterconnectionPortStatus: valid values are %v", v, AllowedInterconnectionPortStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InterconnectionPortStatus) IsValid() bool { + for _, existing := range AllowedInterconnectionPortStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to InterconnectionPort_status value +func (v InterconnectionPortStatus) Ptr() *InterconnectionPortStatus { + return &v +} + +type NullableInterconnectionPortStatus struct { + value *InterconnectionPortStatus + isSet bool +} + +func (v NullableInterconnectionPortStatus) Get() *InterconnectionPortStatus { + return v.value +} + +func (v *NullableInterconnectionPortStatus) Set(val *InterconnectionPortStatus) { + v.value = val + v.isSet = true +} + +func (v NullableInterconnectionPortStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableInterconnectionPortStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInterconnectionPortStatus(val *InterconnectionPortStatus) *NullableInterconnectionPortStatus { + return &NullableInterconnectionPortStatus{value: val, isSet: true} +} + +func (v NullableInterconnectionPortStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInterconnectionPortStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_redundancy.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_redundancy.go new file mode 100644 index 00000000..7e6b5d3a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_redundancy.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// InterconnectionRedundancy Either 'primary', meaning a single interconnection, or 'redundant', meaning a redundant interconnection. +type InterconnectionRedundancy string + +// List of Interconnection_redundancy +const ( + INTERCONNECTIONREDUNDANCY_PRIMARY InterconnectionRedundancy = "primary" + INTERCONNECTIONREDUNDANCY_REDUNDANT InterconnectionRedundancy = "redundant" +) + +// All allowed values of InterconnectionRedundancy enum +var AllowedInterconnectionRedundancyEnumValues = []InterconnectionRedundancy{ + "primary", + "redundant", +} + +func (v *InterconnectionRedundancy) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := InterconnectionRedundancy(value) + for _, existing := range AllowedInterconnectionRedundancyEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InterconnectionRedundancy", value) +} + +// NewInterconnectionRedundancyFromValue returns a pointer to a valid InterconnectionRedundancy +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInterconnectionRedundancyFromValue(v string) (*InterconnectionRedundancy, error) { + ev := InterconnectionRedundancy(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InterconnectionRedundancy: valid values are %v", v, AllowedInterconnectionRedundancyEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InterconnectionRedundancy) IsValid() bool { + for _, existing := range AllowedInterconnectionRedundancyEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Interconnection_redundancy value +func (v InterconnectionRedundancy) Ptr() *InterconnectionRedundancy { + return &v +} + +type NullableInterconnectionRedundancy struct { + value *InterconnectionRedundancy + isSet bool +} + +func (v NullableInterconnectionRedundancy) Get() *InterconnectionRedundancy { + return v.value +} + +func (v *NullableInterconnectionRedundancy) Set(val *InterconnectionRedundancy) { + v.value = val + v.isSet = true +} + +func (v NullableInterconnectionRedundancy) IsSet() bool { + return v.isSet +} + +func (v *NullableInterconnectionRedundancy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInterconnectionRedundancy(val *InterconnectionRedundancy) *NullableInterconnectionRedundancy { + return &NullableInterconnectionRedundancy{value: val, isSet: true} +} + +func (v NullableInterconnectionRedundancy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInterconnectionRedundancy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_type.go new file mode 100644 index 00000000..e117fb69 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_type.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// InterconnectionType The 'shared' type of interconnection refers to shared connections, or later also known as Fabric Virtual Connections (or Fabric VCs). The 'dedicated' type of interconnection refers to interconnections created with Dedicated Ports. +type InterconnectionType string + +// List of Interconnection_type +const ( + INTERCONNECTIONTYPE_SHARED InterconnectionType = "shared" + INTERCONNECTIONTYPE_DEDICATED InterconnectionType = "dedicated" +) + +// All allowed values of InterconnectionType enum +var AllowedInterconnectionTypeEnumValues = []InterconnectionType{ + "shared", + "dedicated", +} + +func (v *InterconnectionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := InterconnectionType(value) + for _, existing := range AllowedInterconnectionTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InterconnectionType", value) +} + +// NewInterconnectionTypeFromValue returns a pointer to a valid InterconnectionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInterconnectionTypeFromValue(v string) (*InterconnectionType, error) { + ev := InterconnectionType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InterconnectionType: valid values are %v", v, AllowedInterconnectionTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InterconnectionType) IsValid() bool { + for _, existing := range AllowedInterconnectionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Interconnection_type value +func (v InterconnectionType) Ptr() *InterconnectionType { + return &v +} + +type NullableInterconnectionType struct { + value *InterconnectionType + isSet bool +} + +func (v NullableInterconnectionType) Get() *InterconnectionType { + return v.value +} + +func (v *NullableInterconnectionType) Set(val *InterconnectionType) { + v.value = val + v.isSet = true +} + +func (v NullableInterconnectionType) IsSet() bool { + return v.isSet +} + +func (v *NullableInterconnectionType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInterconnectionType(val *InterconnectionType) *NullableInterconnectionType { + return &NullableInterconnectionType{value: val, isSet: true} +} + +func (v NullableInterconnectionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInterconnectionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_update_input.go new file mode 100644 index 00000000..edeabe8e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_interconnection_update_input.go @@ -0,0 +1,302 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the InterconnectionUpdateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InterconnectionUpdateInput{} + +// InterconnectionUpdateInput struct for InterconnectionUpdateInput +type InterconnectionUpdateInput struct { + ContactEmail *string `json:"contact_email,omitempty"` + Description *string `json:"description,omitempty"` + Mode *InterconnectionMode `json:"mode,omitempty"` + Name *string `json:"name,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InterconnectionUpdateInput InterconnectionUpdateInput + +// NewInterconnectionUpdateInput instantiates a new InterconnectionUpdateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInterconnectionUpdateInput() *InterconnectionUpdateInput { + this := InterconnectionUpdateInput{} + return &this +} + +// NewInterconnectionUpdateInputWithDefaults instantiates a new InterconnectionUpdateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInterconnectionUpdateInputWithDefaults() *InterconnectionUpdateInput { + this := InterconnectionUpdateInput{} + return &this +} + +// GetContactEmail returns the ContactEmail field value if set, zero value otherwise. +func (o *InterconnectionUpdateInput) GetContactEmail() string { + if o == nil || IsNil(o.ContactEmail) { + var ret string + return ret + } + return *o.ContactEmail +} + +// GetContactEmailOk returns a tuple with the ContactEmail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionUpdateInput) GetContactEmailOk() (*string, bool) { + if o == nil || IsNil(o.ContactEmail) { + return nil, false + } + return o.ContactEmail, true +} + +// HasContactEmail returns a boolean if a field has been set. +func (o *InterconnectionUpdateInput) HasContactEmail() bool { + if o != nil && !IsNil(o.ContactEmail) { + return true + } + + return false +} + +// SetContactEmail gets a reference to the given string and assigns it to the ContactEmail field. +func (o *InterconnectionUpdateInput) SetContactEmail(v string) { + o.ContactEmail = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *InterconnectionUpdateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionUpdateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *InterconnectionUpdateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *InterconnectionUpdateInput) SetDescription(v string) { + o.Description = &v +} + +// GetMode returns the Mode field value if set, zero value otherwise. +func (o *InterconnectionUpdateInput) GetMode() InterconnectionMode { + if o == nil || IsNil(o.Mode) { + var ret InterconnectionMode + return ret + } + return *o.Mode +} + +// GetModeOk returns a tuple with the Mode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionUpdateInput) GetModeOk() (*InterconnectionMode, bool) { + if o == nil || IsNil(o.Mode) { + return nil, false + } + return o.Mode, true +} + +// HasMode returns a boolean if a field has been set. +func (o *InterconnectionUpdateInput) HasMode() bool { + if o != nil && !IsNil(o.Mode) { + return true + } + + return false +} + +// SetMode gets a reference to the given InterconnectionMode and assigns it to the Mode field. +func (o *InterconnectionUpdateInput) SetMode(v InterconnectionMode) { + o.Mode = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *InterconnectionUpdateInput) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionUpdateInput) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *InterconnectionUpdateInput) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *InterconnectionUpdateInput) SetName(v string) { + o.Name = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *InterconnectionUpdateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InterconnectionUpdateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *InterconnectionUpdateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *InterconnectionUpdateInput) SetTags(v []string) { + o.Tags = v +} + +func (o InterconnectionUpdateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InterconnectionUpdateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ContactEmail) { + toSerialize["contact_email"] = o.ContactEmail + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Mode) { + toSerialize["mode"] = o.Mode + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InterconnectionUpdateInput) UnmarshalJSON(data []byte) (err error) { + varInterconnectionUpdateInput := _InterconnectionUpdateInput{} + + err = json.Unmarshal(data, &varInterconnectionUpdateInput) + + if err != nil { + return err + } + + *o = InterconnectionUpdateInput(varInterconnectionUpdateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "contact_email") + delete(additionalProperties, "description") + delete(additionalProperties, "mode") + delete(additionalProperties, "name") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInterconnectionUpdateInput struct { + value *InterconnectionUpdateInput + isSet bool +} + +func (v NullableInterconnectionUpdateInput) Get() *InterconnectionUpdateInput { + return v.value +} + +func (v *NullableInterconnectionUpdateInput) Set(val *InterconnectionUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullableInterconnectionUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableInterconnectionUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInterconnectionUpdateInput(val *InterconnectionUpdateInput) *NullableInterconnectionUpdateInput { + return &NullableInterconnectionUpdateInput{value: val, isSet: true} +} + +func (v NullableInterconnectionUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInterconnectionUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation.go new file mode 100644 index 00000000..8a267181 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation.go @@ -0,0 +1,525 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the Invitation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Invitation{} + +// Invitation struct for Invitation +type Invitation struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Invitation *Href `json:"invitation,omitempty"` + InvitedBy *Href `json:"invited_by,omitempty"` + Invitee *string `json:"invitee,omitempty"` + Nonce *string `json:"nonce,omitempty"` + Organization *Href `json:"organization,omitempty"` + Projects []Href `json:"projects,omitempty"` + Roles []InvitationRolesInner `json:"roles,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Invitation Invitation + +// NewInvitation instantiates a new Invitation object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInvitation() *Invitation { + this := Invitation{} + return &this +} + +// NewInvitationWithDefaults instantiates a new Invitation object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInvitationWithDefaults() *Invitation { + this := Invitation{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Invitation) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Invitation) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Invitation) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Invitation) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *Invitation) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Invitation) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Invitation) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Invitation) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Invitation) SetId(v string) { + o.Id = &v +} + +// GetInvitation returns the Invitation field value if set, zero value otherwise. +func (o *Invitation) GetInvitation() Href { + if o == nil || IsNil(o.Invitation) { + var ret Href + return ret + } + return *o.Invitation +} + +// GetInvitationOk returns a tuple with the Invitation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetInvitationOk() (*Href, bool) { + if o == nil || IsNil(o.Invitation) { + return nil, false + } + return o.Invitation, true +} + +// HasInvitation returns a boolean if a field has been set. +func (o *Invitation) HasInvitation() bool { + if o != nil && !IsNil(o.Invitation) { + return true + } + + return false +} + +// SetInvitation gets a reference to the given Href and assigns it to the Invitation field. +func (o *Invitation) SetInvitation(v Href) { + o.Invitation = &v +} + +// GetInvitedBy returns the InvitedBy field value if set, zero value otherwise. +func (o *Invitation) GetInvitedBy() Href { + if o == nil || IsNil(o.InvitedBy) { + var ret Href + return ret + } + return *o.InvitedBy +} + +// GetInvitedByOk returns a tuple with the InvitedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetInvitedByOk() (*Href, bool) { + if o == nil || IsNil(o.InvitedBy) { + return nil, false + } + return o.InvitedBy, true +} + +// HasInvitedBy returns a boolean if a field has been set. +func (o *Invitation) HasInvitedBy() bool { + if o != nil && !IsNil(o.InvitedBy) { + return true + } + + return false +} + +// SetInvitedBy gets a reference to the given Href and assigns it to the InvitedBy field. +func (o *Invitation) SetInvitedBy(v Href) { + o.InvitedBy = &v +} + +// GetInvitee returns the Invitee field value if set, zero value otherwise. +func (o *Invitation) GetInvitee() string { + if o == nil || IsNil(o.Invitee) { + var ret string + return ret + } + return *o.Invitee +} + +// GetInviteeOk returns a tuple with the Invitee field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetInviteeOk() (*string, bool) { + if o == nil || IsNil(o.Invitee) { + return nil, false + } + return o.Invitee, true +} + +// HasInvitee returns a boolean if a field has been set. +func (o *Invitation) HasInvitee() bool { + if o != nil && !IsNil(o.Invitee) { + return true + } + + return false +} + +// SetInvitee gets a reference to the given string and assigns it to the Invitee field. +func (o *Invitation) SetInvitee(v string) { + o.Invitee = &v +} + +// GetNonce returns the Nonce field value if set, zero value otherwise. +func (o *Invitation) GetNonce() string { + if o == nil || IsNil(o.Nonce) { + var ret string + return ret + } + return *o.Nonce +} + +// GetNonceOk returns a tuple with the Nonce field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetNonceOk() (*string, bool) { + if o == nil || IsNil(o.Nonce) { + return nil, false + } + return o.Nonce, true +} + +// HasNonce returns a boolean if a field has been set. +func (o *Invitation) HasNonce() bool { + if o != nil && !IsNil(o.Nonce) { + return true + } + + return false +} + +// SetNonce gets a reference to the given string and assigns it to the Nonce field. +func (o *Invitation) SetNonce(v string) { + o.Nonce = &v +} + +// GetOrganization returns the Organization field value if set, zero value otherwise. +func (o *Invitation) GetOrganization() Href { + if o == nil || IsNil(o.Organization) { + var ret Href + return ret + } + return *o.Organization +} + +// GetOrganizationOk returns a tuple with the Organization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetOrganizationOk() (*Href, bool) { + if o == nil || IsNil(o.Organization) { + return nil, false + } + return o.Organization, true +} + +// HasOrganization returns a boolean if a field has been set. +func (o *Invitation) HasOrganization() bool { + if o != nil && !IsNil(o.Organization) { + return true + } + + return false +} + +// SetOrganization gets a reference to the given Href and assigns it to the Organization field. +func (o *Invitation) SetOrganization(v Href) { + o.Organization = &v +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *Invitation) GetProjects() []Href { + if o == nil || IsNil(o.Projects) { + var ret []Href + return ret + } + return o.Projects +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetProjectsOk() ([]Href, bool) { + if o == nil || IsNil(o.Projects) { + return nil, false + } + return o.Projects, true +} + +// HasProjects returns a boolean if a field has been set. +func (o *Invitation) HasProjects() bool { + if o != nil && !IsNil(o.Projects) { + return true + } + + return false +} + +// SetProjects gets a reference to the given []Href and assigns it to the Projects field. +func (o *Invitation) SetProjects(v []Href) { + o.Projects = v +} + +// GetRoles returns the Roles field value if set, zero value otherwise. +func (o *Invitation) GetRoles() []InvitationRolesInner { + if o == nil || IsNil(o.Roles) { + var ret []InvitationRolesInner + return ret + } + return o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetRolesOk() ([]InvitationRolesInner, bool) { + if o == nil || IsNil(o.Roles) { + return nil, false + } + return o.Roles, true +} + +// HasRoles returns a boolean if a field has been set. +func (o *Invitation) HasRoles() bool { + if o != nil && !IsNil(o.Roles) { + return true + } + + return false +} + +// SetRoles gets a reference to the given []InvitationRolesInner and assigns it to the Roles field. +func (o *Invitation) SetRoles(v []InvitationRolesInner) { + o.Roles = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Invitation) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invitation) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Invitation) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Invitation) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o Invitation) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Invitation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Invitation) { + toSerialize["invitation"] = o.Invitation + } + if !IsNil(o.InvitedBy) { + toSerialize["invited_by"] = o.InvitedBy + } + if !IsNil(o.Invitee) { + toSerialize["invitee"] = o.Invitee + } + if !IsNil(o.Nonce) { + toSerialize["nonce"] = o.Nonce + } + if !IsNil(o.Organization) { + toSerialize["organization"] = o.Organization + } + if !IsNil(o.Projects) { + toSerialize["projects"] = o.Projects + } + if !IsNil(o.Roles) { + toSerialize["roles"] = o.Roles + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Invitation) UnmarshalJSON(data []byte) (err error) { + varInvitation := _Invitation{} + + err = json.Unmarshal(data, &varInvitation) + + if err != nil { + return err + } + + *o = Invitation(varInvitation) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "invitation") + delete(additionalProperties, "invited_by") + delete(additionalProperties, "invitee") + delete(additionalProperties, "nonce") + delete(additionalProperties, "organization") + delete(additionalProperties, "projects") + delete(additionalProperties, "roles") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInvitation struct { + value *Invitation + isSet bool +} + +func (v NullableInvitation) Get() *Invitation { + return v.value +} + +func (v *NullableInvitation) Set(val *Invitation) { + v.value = val + v.isSet = true +} + +func (v NullableInvitation) IsSet() bool { + return v.isSet +} + +func (v *NullableInvitation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInvitation(val *Invitation) *NullableInvitation { + return &NullableInvitation{value: val, isSet: true} +} + +func (v NullableInvitation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInvitation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_input.go new file mode 100644 index 00000000..7c931b77 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_input.go @@ -0,0 +1,315 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the InvitationInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InvitationInput{} + +// InvitationInput struct for InvitationInput +type InvitationInput struct { + Invitee string `json:"invitee"` + Message *string `json:"message,omitempty"` + OrganizationId *string `json:"organization_id,omitempty"` + ProjectsIds []string `json:"projects_ids,omitempty"` + Roles []InvitationRolesInner `json:"roles,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InvitationInput InvitationInput + +// NewInvitationInput instantiates a new InvitationInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInvitationInput(invitee string) *InvitationInput { + this := InvitationInput{} + this.Invitee = invitee + return &this +} + +// NewInvitationInputWithDefaults instantiates a new InvitationInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInvitationInputWithDefaults() *InvitationInput { + this := InvitationInput{} + return &this +} + +// GetInvitee returns the Invitee field value +func (o *InvitationInput) GetInvitee() string { + if o == nil { + var ret string + return ret + } + + return o.Invitee +} + +// GetInviteeOk returns a tuple with the Invitee field value +// and a boolean to check if the value has been set. +func (o *InvitationInput) GetInviteeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Invitee, true +} + +// SetInvitee sets field value +func (o *InvitationInput) SetInvitee(v string) { + o.Invitee = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *InvitationInput) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InvitationInput) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *InvitationInput) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *InvitationInput) SetMessage(v string) { + o.Message = &v +} + +// GetOrganizationId returns the OrganizationId field value if set, zero value otherwise. +func (o *InvitationInput) GetOrganizationId() string { + if o == nil || IsNil(o.OrganizationId) { + var ret string + return ret + } + return *o.OrganizationId +} + +// GetOrganizationIdOk returns a tuple with the OrganizationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InvitationInput) GetOrganizationIdOk() (*string, bool) { + if o == nil || IsNil(o.OrganizationId) { + return nil, false + } + return o.OrganizationId, true +} + +// HasOrganizationId returns a boolean if a field has been set. +func (o *InvitationInput) HasOrganizationId() bool { + if o != nil && !IsNil(o.OrganizationId) { + return true + } + + return false +} + +// SetOrganizationId gets a reference to the given string and assigns it to the OrganizationId field. +func (o *InvitationInput) SetOrganizationId(v string) { + o.OrganizationId = &v +} + +// GetProjectsIds returns the ProjectsIds field value if set, zero value otherwise. +func (o *InvitationInput) GetProjectsIds() []string { + if o == nil || IsNil(o.ProjectsIds) { + var ret []string + return ret + } + return o.ProjectsIds +} + +// GetProjectsIdsOk returns a tuple with the ProjectsIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InvitationInput) GetProjectsIdsOk() ([]string, bool) { + if o == nil || IsNil(o.ProjectsIds) { + return nil, false + } + return o.ProjectsIds, true +} + +// HasProjectsIds returns a boolean if a field has been set. +func (o *InvitationInput) HasProjectsIds() bool { + if o != nil && !IsNil(o.ProjectsIds) { + return true + } + + return false +} + +// SetProjectsIds gets a reference to the given []string and assigns it to the ProjectsIds field. +func (o *InvitationInput) SetProjectsIds(v []string) { + o.ProjectsIds = v +} + +// GetRoles returns the Roles field value if set, zero value otherwise. +func (o *InvitationInput) GetRoles() []InvitationRolesInner { + if o == nil || IsNil(o.Roles) { + var ret []InvitationRolesInner + return ret + } + return o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InvitationInput) GetRolesOk() ([]InvitationRolesInner, bool) { + if o == nil || IsNil(o.Roles) { + return nil, false + } + return o.Roles, true +} + +// HasRoles returns a boolean if a field has been set. +func (o *InvitationInput) HasRoles() bool { + if o != nil && !IsNil(o.Roles) { + return true + } + + return false +} + +// SetRoles gets a reference to the given []InvitationRolesInner and assigns it to the Roles field. +func (o *InvitationInput) SetRoles(v []InvitationRolesInner) { + o.Roles = v +} + +func (o InvitationInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InvitationInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["invitee"] = o.Invitee + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + if !IsNil(o.OrganizationId) { + toSerialize["organization_id"] = o.OrganizationId + } + if !IsNil(o.ProjectsIds) { + toSerialize["projects_ids"] = o.ProjectsIds + } + if !IsNil(o.Roles) { + toSerialize["roles"] = o.Roles + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InvitationInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "invitee", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varInvitationInput := _InvitationInput{} + + err = json.Unmarshal(data, &varInvitationInput) + + if err != nil { + return err + } + + *o = InvitationInput(varInvitationInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "invitee") + delete(additionalProperties, "message") + delete(additionalProperties, "organization_id") + delete(additionalProperties, "projects_ids") + delete(additionalProperties, "roles") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInvitationInput struct { + value *InvitationInput + isSet bool +} + +func (v NullableInvitationInput) Get() *InvitationInput { + return v.value +} + +func (v *NullableInvitationInput) Set(val *InvitationInput) { + v.value = val + v.isSet = true +} + +func (v NullableInvitationInput) IsSet() bool { + return v.isSet +} + +func (v *NullableInvitationInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInvitationInput(val *InvitationInput) *NullableInvitationInput { + return &NullableInvitationInput{value: val, isSet: true} +} + +func (v NullableInvitationInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInvitationInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_list.go new file mode 100644 index 00000000..fb2f9785 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the InvitationList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InvitationList{} + +// InvitationList struct for InvitationList +type InvitationList struct { + Invitations []Membership `json:"invitations,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InvitationList InvitationList + +// NewInvitationList instantiates a new InvitationList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInvitationList() *InvitationList { + this := InvitationList{} + return &this +} + +// NewInvitationListWithDefaults instantiates a new InvitationList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInvitationListWithDefaults() *InvitationList { + this := InvitationList{} + return &this +} + +// GetInvitations returns the Invitations field value if set, zero value otherwise. +func (o *InvitationList) GetInvitations() []Membership { + if o == nil || IsNil(o.Invitations) { + var ret []Membership + return ret + } + return o.Invitations +} + +// GetInvitationsOk returns a tuple with the Invitations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InvitationList) GetInvitationsOk() ([]Membership, bool) { + if o == nil || IsNil(o.Invitations) { + return nil, false + } + return o.Invitations, true +} + +// HasInvitations returns a boolean if a field has been set. +func (o *InvitationList) HasInvitations() bool { + if o != nil && !IsNil(o.Invitations) { + return true + } + + return false +} + +// SetInvitations gets a reference to the given []Membership and assigns it to the Invitations field. +func (o *InvitationList) SetInvitations(v []Membership) { + o.Invitations = v +} + +func (o InvitationList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InvitationList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Invitations) { + toSerialize["invitations"] = o.Invitations + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InvitationList) UnmarshalJSON(data []byte) (err error) { + varInvitationList := _InvitationList{} + + err = json.Unmarshal(data, &varInvitationList) + + if err != nil { + return err + } + + *o = InvitationList(varInvitationList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "invitations") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInvitationList struct { + value *InvitationList + isSet bool +} + +func (v NullableInvitationList) Get() *InvitationList { + return v.value +} + +func (v *NullableInvitationList) Set(val *InvitationList) { + v.value = val + v.isSet = true +} + +func (v NullableInvitationList) IsSet() bool { + return v.isSet +} + +func (v *NullableInvitationList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInvitationList(val *InvitationList) *NullableInvitationList { + return &NullableInvitationList{value: val, isSet: true} +} + +func (v NullableInvitationList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInvitationList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_roles_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_roles_inner.go new file mode 100644 index 00000000..086633d0 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invitation_roles_inner.go @@ -0,0 +1,115 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// InvitationRolesInner the model 'InvitationRolesInner' +type InvitationRolesInner string + +// List of Invitation_roles_inner +const ( + INVITATIONROLESINNER_ADMIN InvitationRolesInner = "admin" + INVITATIONROLESINNER_BILLING InvitationRolesInner = "billing" + INVITATIONROLESINNER_COLLABORATOR InvitationRolesInner = "collaborator" + INVITATIONROLESINNER_LIMITED_COLLABORATOR InvitationRolesInner = "limited_collaborator" +) + +// All allowed values of InvitationRolesInner enum +var AllowedInvitationRolesInnerEnumValues = []InvitationRolesInner{ + "admin", + "billing", + "collaborator", + "limited_collaborator", +} + +func (v *InvitationRolesInner) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := InvitationRolesInner(value) + for _, existing := range AllowedInvitationRolesInnerEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InvitationRolesInner", value) +} + +// NewInvitationRolesInnerFromValue returns a pointer to a valid InvitationRolesInner +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInvitationRolesInnerFromValue(v string) (*InvitationRolesInner, error) { + ev := InvitationRolesInner(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InvitationRolesInner: valid values are %v", v, AllowedInvitationRolesInnerEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InvitationRolesInner) IsValid() bool { + for _, existing := range AllowedInvitationRolesInnerEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Invitation_roles_inner value +func (v InvitationRolesInner) Ptr() *InvitationRolesInner { + return &v +} + +type NullableInvitationRolesInner struct { + value *InvitationRolesInner + isSet bool +} + +func (v NullableInvitationRolesInner) Get() *InvitationRolesInner { + return v.value +} + +func (v *NullableInvitationRolesInner) Set(val *InvitationRolesInner) { + v.value = val + v.isSet = true +} + +func (v NullableInvitationRolesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableInvitationRolesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInvitationRolesInner(val *InvitationRolesInner) *NullableInvitationRolesInner { + return &NullableInvitationRolesInner{value: val, isSet: true} +} + +func (v NullableInvitationRolesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInvitationRolesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invoice.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invoice.go new file mode 100644 index 00000000..a2776ec5 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invoice.go @@ -0,0 +1,635 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Invoice type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Invoice{} + +// Invoice struct for Invoice +type Invoice struct { + Amount *float32 `json:"amount,omitempty"` + Balance *float32 `json:"balance,omitempty"` + CreatedOn *string `json:"created_on,omitempty"` + CreditAmount *float32 `json:"credit_amount,omitempty"` + CreditsApplied *float32 `json:"credits_applied,omitempty"` + Currency *string `json:"currency,omitempty"` + DueOn *string `json:"due_on,omitempty"` + Id *string `json:"id,omitempty"` + Items []LineItem `json:"items,omitempty"` + Number *string `json:"number,omitempty"` + Project *ProjectIdName `json:"project,omitempty"` + ReferenceNumber *string `json:"reference_number,omitempty"` + Status *string `json:"status,omitempty"` + TargetDate *string `json:"target_date,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Invoice Invoice + +// NewInvoice instantiates a new Invoice object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInvoice() *Invoice { + this := Invoice{} + return &this +} + +// NewInvoiceWithDefaults instantiates a new Invoice object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInvoiceWithDefaults() *Invoice { + this := Invoice{} + return &this +} + +// GetAmount returns the Amount field value if set, zero value otherwise. +func (o *Invoice) GetAmount() float32 { + if o == nil || IsNil(o.Amount) { + var ret float32 + return ret + } + return *o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetAmountOk() (*float32, bool) { + if o == nil || IsNil(o.Amount) { + return nil, false + } + return o.Amount, true +} + +// HasAmount returns a boolean if a field has been set. +func (o *Invoice) HasAmount() bool { + if o != nil && !IsNil(o.Amount) { + return true + } + + return false +} + +// SetAmount gets a reference to the given float32 and assigns it to the Amount field. +func (o *Invoice) SetAmount(v float32) { + o.Amount = &v +} + +// GetBalance returns the Balance field value if set, zero value otherwise. +func (o *Invoice) GetBalance() float32 { + if o == nil || IsNil(o.Balance) { + var ret float32 + return ret + } + return *o.Balance +} + +// GetBalanceOk returns a tuple with the Balance field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetBalanceOk() (*float32, bool) { + if o == nil || IsNil(o.Balance) { + return nil, false + } + return o.Balance, true +} + +// HasBalance returns a boolean if a field has been set. +func (o *Invoice) HasBalance() bool { + if o != nil && !IsNil(o.Balance) { + return true + } + + return false +} + +// SetBalance gets a reference to the given float32 and assigns it to the Balance field. +func (o *Invoice) SetBalance(v float32) { + o.Balance = &v +} + +// GetCreatedOn returns the CreatedOn field value if set, zero value otherwise. +func (o *Invoice) GetCreatedOn() string { + if o == nil || IsNil(o.CreatedOn) { + var ret string + return ret + } + return *o.CreatedOn +} + +// GetCreatedOnOk returns a tuple with the CreatedOn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetCreatedOnOk() (*string, bool) { + if o == nil || IsNil(o.CreatedOn) { + return nil, false + } + return o.CreatedOn, true +} + +// HasCreatedOn returns a boolean if a field has been set. +func (o *Invoice) HasCreatedOn() bool { + if o != nil && !IsNil(o.CreatedOn) { + return true + } + + return false +} + +// SetCreatedOn gets a reference to the given string and assigns it to the CreatedOn field. +func (o *Invoice) SetCreatedOn(v string) { + o.CreatedOn = &v +} + +// GetCreditAmount returns the CreditAmount field value if set, zero value otherwise. +func (o *Invoice) GetCreditAmount() float32 { + if o == nil || IsNil(o.CreditAmount) { + var ret float32 + return ret + } + return *o.CreditAmount +} + +// GetCreditAmountOk returns a tuple with the CreditAmount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetCreditAmountOk() (*float32, bool) { + if o == nil || IsNil(o.CreditAmount) { + return nil, false + } + return o.CreditAmount, true +} + +// HasCreditAmount returns a boolean if a field has been set. +func (o *Invoice) HasCreditAmount() bool { + if o != nil && !IsNil(o.CreditAmount) { + return true + } + + return false +} + +// SetCreditAmount gets a reference to the given float32 and assigns it to the CreditAmount field. +func (o *Invoice) SetCreditAmount(v float32) { + o.CreditAmount = &v +} + +// GetCreditsApplied returns the CreditsApplied field value if set, zero value otherwise. +func (o *Invoice) GetCreditsApplied() float32 { + if o == nil || IsNil(o.CreditsApplied) { + var ret float32 + return ret + } + return *o.CreditsApplied +} + +// GetCreditsAppliedOk returns a tuple with the CreditsApplied field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetCreditsAppliedOk() (*float32, bool) { + if o == nil || IsNil(o.CreditsApplied) { + return nil, false + } + return o.CreditsApplied, true +} + +// HasCreditsApplied returns a boolean if a field has been set. +func (o *Invoice) HasCreditsApplied() bool { + if o != nil && !IsNil(o.CreditsApplied) { + return true + } + + return false +} + +// SetCreditsApplied gets a reference to the given float32 and assigns it to the CreditsApplied field. +func (o *Invoice) SetCreditsApplied(v float32) { + o.CreditsApplied = &v +} + +// GetCurrency returns the Currency field value if set, zero value otherwise. +func (o *Invoice) GetCurrency() string { + if o == nil || IsNil(o.Currency) { + var ret string + return ret + } + return *o.Currency +} + +// GetCurrencyOk returns a tuple with the Currency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetCurrencyOk() (*string, bool) { + if o == nil || IsNil(o.Currency) { + return nil, false + } + return o.Currency, true +} + +// HasCurrency returns a boolean if a field has been set. +func (o *Invoice) HasCurrency() bool { + if o != nil && !IsNil(o.Currency) { + return true + } + + return false +} + +// SetCurrency gets a reference to the given string and assigns it to the Currency field. +func (o *Invoice) SetCurrency(v string) { + o.Currency = &v +} + +// GetDueOn returns the DueOn field value if set, zero value otherwise. +func (o *Invoice) GetDueOn() string { + if o == nil || IsNil(o.DueOn) { + var ret string + return ret + } + return *o.DueOn +} + +// GetDueOnOk returns a tuple with the DueOn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetDueOnOk() (*string, bool) { + if o == nil || IsNil(o.DueOn) { + return nil, false + } + return o.DueOn, true +} + +// HasDueOn returns a boolean if a field has been set. +func (o *Invoice) HasDueOn() bool { + if o != nil && !IsNil(o.DueOn) { + return true + } + + return false +} + +// SetDueOn gets a reference to the given string and assigns it to the DueOn field. +func (o *Invoice) SetDueOn(v string) { + o.DueOn = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Invoice) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Invoice) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Invoice) SetId(v string) { + o.Id = &v +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Invoice) GetItems() []LineItem { + if o == nil || IsNil(o.Items) { + var ret []LineItem + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetItemsOk() ([]LineItem, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *Invoice) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []LineItem and assigns it to the Items field. +func (o *Invoice) SetItems(v []LineItem) { + o.Items = v +} + +// GetNumber returns the Number field value if set, zero value otherwise. +func (o *Invoice) GetNumber() string { + if o == nil || IsNil(o.Number) { + var ret string + return ret + } + return *o.Number +} + +// GetNumberOk returns a tuple with the Number field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetNumberOk() (*string, bool) { + if o == nil || IsNil(o.Number) { + return nil, false + } + return o.Number, true +} + +// HasNumber returns a boolean if a field has been set. +func (o *Invoice) HasNumber() bool { + if o != nil && !IsNil(o.Number) { + return true + } + + return false +} + +// SetNumber gets a reference to the given string and assigns it to the Number field. +func (o *Invoice) SetNumber(v string) { + o.Number = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *Invoice) GetProject() ProjectIdName { + if o == nil || IsNil(o.Project) { + var ret ProjectIdName + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetProjectOk() (*ProjectIdName, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *Invoice) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given ProjectIdName and assigns it to the Project field. +func (o *Invoice) SetProject(v ProjectIdName) { + o.Project = &v +} + +// GetReferenceNumber returns the ReferenceNumber field value if set, zero value otherwise. +func (o *Invoice) GetReferenceNumber() string { + if o == nil || IsNil(o.ReferenceNumber) { + var ret string + return ret + } + return *o.ReferenceNumber +} + +// GetReferenceNumberOk returns a tuple with the ReferenceNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetReferenceNumberOk() (*string, bool) { + if o == nil || IsNil(o.ReferenceNumber) { + return nil, false + } + return o.ReferenceNumber, true +} + +// HasReferenceNumber returns a boolean if a field has been set. +func (o *Invoice) HasReferenceNumber() bool { + if o != nil && !IsNil(o.ReferenceNumber) { + return true + } + + return false +} + +// SetReferenceNumber gets a reference to the given string and assigns it to the ReferenceNumber field. +func (o *Invoice) SetReferenceNumber(v string) { + o.ReferenceNumber = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Invoice) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Invoice) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Invoice) SetStatus(v string) { + o.Status = &v +} + +// GetTargetDate returns the TargetDate field value if set, zero value otherwise. +func (o *Invoice) GetTargetDate() string { + if o == nil || IsNil(o.TargetDate) { + var ret string + return ret + } + return *o.TargetDate +} + +// GetTargetDateOk returns a tuple with the TargetDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invoice) GetTargetDateOk() (*string, bool) { + if o == nil || IsNil(o.TargetDate) { + return nil, false + } + return o.TargetDate, true +} + +// HasTargetDate returns a boolean if a field has been set. +func (o *Invoice) HasTargetDate() bool { + if o != nil && !IsNil(o.TargetDate) { + return true + } + + return false +} + +// SetTargetDate gets a reference to the given string and assigns it to the TargetDate field. +func (o *Invoice) SetTargetDate(v string) { + o.TargetDate = &v +} + +func (o Invoice) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Invoice) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Amount) { + toSerialize["amount"] = o.Amount + } + if !IsNil(o.Balance) { + toSerialize["balance"] = o.Balance + } + if !IsNil(o.CreatedOn) { + toSerialize["created_on"] = o.CreatedOn + } + if !IsNil(o.CreditAmount) { + toSerialize["credit_amount"] = o.CreditAmount + } + if !IsNil(o.CreditsApplied) { + toSerialize["credits_applied"] = o.CreditsApplied + } + if !IsNil(o.Currency) { + toSerialize["currency"] = o.Currency + } + if !IsNil(o.DueOn) { + toSerialize["due_on"] = o.DueOn + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + if !IsNil(o.Number) { + toSerialize["number"] = o.Number + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.ReferenceNumber) { + toSerialize["reference_number"] = o.ReferenceNumber + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.TargetDate) { + toSerialize["target_date"] = o.TargetDate + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Invoice) UnmarshalJSON(data []byte) (err error) { + varInvoice := _Invoice{} + + err = json.Unmarshal(data, &varInvoice) + + if err != nil { + return err + } + + *o = Invoice(varInvoice) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "amount") + delete(additionalProperties, "balance") + delete(additionalProperties, "created_on") + delete(additionalProperties, "credit_amount") + delete(additionalProperties, "credits_applied") + delete(additionalProperties, "currency") + delete(additionalProperties, "due_on") + delete(additionalProperties, "id") + delete(additionalProperties, "items") + delete(additionalProperties, "number") + delete(additionalProperties, "project") + delete(additionalProperties, "reference_number") + delete(additionalProperties, "status") + delete(additionalProperties, "target_date") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInvoice struct { + value *Invoice + isSet bool +} + +func (v NullableInvoice) Get() *Invoice { + return v.value +} + +func (v *NullableInvoice) Set(val *Invoice) { + v.value = val + v.isSet = true +} + +func (v NullableInvoice) IsSet() bool { + return v.isSet +} + +func (v *NullableInvoice) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInvoice(val *Invoice) *NullableInvoice { + return &NullableInvoice{value: val, isSet: true} +} + +func (v NullableInvoice) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInvoice) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invoice_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invoice_list.go new file mode 100644 index 00000000..1d14efea --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_invoice_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the InvoiceList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InvoiceList{} + +// InvoiceList struct for InvoiceList +type InvoiceList struct { + Invoices []Invoice `json:"invoices,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InvoiceList InvoiceList + +// NewInvoiceList instantiates a new InvoiceList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInvoiceList() *InvoiceList { + this := InvoiceList{} + return &this +} + +// NewInvoiceListWithDefaults instantiates a new InvoiceList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInvoiceListWithDefaults() *InvoiceList { + this := InvoiceList{} + return &this +} + +// GetInvoices returns the Invoices field value if set, zero value otherwise. +func (o *InvoiceList) GetInvoices() []Invoice { + if o == nil || IsNil(o.Invoices) { + var ret []Invoice + return ret + } + return o.Invoices +} + +// GetInvoicesOk returns a tuple with the Invoices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InvoiceList) GetInvoicesOk() ([]Invoice, bool) { + if o == nil || IsNil(o.Invoices) { + return nil, false + } + return o.Invoices, true +} + +// HasInvoices returns a boolean if a field has been set. +func (o *InvoiceList) HasInvoices() bool { + if o != nil && !IsNil(o.Invoices) { + return true + } + + return false +} + +// SetInvoices gets a reference to the given []Invoice and assigns it to the Invoices field. +func (o *InvoiceList) SetInvoices(v []Invoice) { + o.Invoices = v +} + +func (o InvoiceList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InvoiceList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Invoices) { + toSerialize["invoices"] = o.Invoices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InvoiceList) UnmarshalJSON(data []byte) (err error) { + varInvoiceList := _InvoiceList{} + + err = json.Unmarshal(data, &varInvoiceList) + + if err != nil { + return err + } + + *o = InvoiceList(varInvoiceList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "invoices") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInvoiceList struct { + value *InvoiceList + isSet bool +} + +func (v NullableInvoiceList) Get() *InvoiceList { + return v.value +} + +func (v *NullableInvoiceList) Set(val *InvoiceList) { + v.value = val + v.isSet = true +} + +func (v NullableInvoiceList) IsSet() bool { + return v.isSet +} + +func (v *NullableInvoiceList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInvoiceList(val *InvoiceList) *NullableInvoiceList { + return &NullableInvoiceList{value: val, isSet: true} +} + +func (v NullableInvoiceList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInvoiceList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_address.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_address.go new file mode 100644 index 00000000..2708d96a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_address.go @@ -0,0 +1,272 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the IPAddress type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPAddress{} + +// IPAddress struct for IPAddress +type IPAddress struct { + AddressFamily *IPAddressAddressFamily `json:"address_family,omitempty"` + // Cidr Size for the IP Block created. Valid values depends on the operating system being provisioned. (28..32 for IPv4 addresses, 124..127 for IPv6 addresses) + Cidr *int32 `json:"cidr,omitempty"` + // UUIDs of any IP reservations to use when assigning IPs + IpReservations []string `json:"ip_reservations,omitempty"` + // Address Type for IP Address + Public *bool `json:"public,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IPAddress IPAddress + +// NewIPAddress instantiates a new IPAddress object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPAddress() *IPAddress { + this := IPAddress{} + var public bool = true + this.Public = &public + return &this +} + +// NewIPAddressWithDefaults instantiates a new IPAddress object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPAddressWithDefaults() *IPAddress { + this := IPAddress{} + var public bool = true + this.Public = &public + return &this +} + +// GetAddressFamily returns the AddressFamily field value if set, zero value otherwise. +func (o *IPAddress) GetAddressFamily() IPAddressAddressFamily { + if o == nil || IsNil(o.AddressFamily) { + var ret IPAddressAddressFamily + return ret + } + return *o.AddressFamily +} + +// GetAddressFamilyOk returns a tuple with the AddressFamily field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAddress) GetAddressFamilyOk() (*IPAddressAddressFamily, bool) { + if o == nil || IsNil(o.AddressFamily) { + return nil, false + } + return o.AddressFamily, true +} + +// HasAddressFamily returns a boolean if a field has been set. +func (o *IPAddress) HasAddressFamily() bool { + if o != nil && !IsNil(o.AddressFamily) { + return true + } + + return false +} + +// SetAddressFamily gets a reference to the given IPAddressAddressFamily and assigns it to the AddressFamily field. +func (o *IPAddress) SetAddressFamily(v IPAddressAddressFamily) { + o.AddressFamily = &v +} + +// GetCidr returns the Cidr field value if set, zero value otherwise. +func (o *IPAddress) GetCidr() int32 { + if o == nil || IsNil(o.Cidr) { + var ret int32 + return ret + } + return *o.Cidr +} + +// GetCidrOk returns a tuple with the Cidr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAddress) GetCidrOk() (*int32, bool) { + if o == nil || IsNil(o.Cidr) { + return nil, false + } + return o.Cidr, true +} + +// HasCidr returns a boolean if a field has been set. +func (o *IPAddress) HasCidr() bool { + if o != nil && !IsNil(o.Cidr) { + return true + } + + return false +} + +// SetCidr gets a reference to the given int32 and assigns it to the Cidr field. +func (o *IPAddress) SetCidr(v int32) { + o.Cidr = &v +} + +// GetIpReservations returns the IpReservations field value if set, zero value otherwise. +func (o *IPAddress) GetIpReservations() []string { + if o == nil || IsNil(o.IpReservations) { + var ret []string + return ret + } + return o.IpReservations +} + +// GetIpReservationsOk returns a tuple with the IpReservations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAddress) GetIpReservationsOk() ([]string, bool) { + if o == nil || IsNil(o.IpReservations) { + return nil, false + } + return o.IpReservations, true +} + +// HasIpReservations returns a boolean if a field has been set. +func (o *IPAddress) HasIpReservations() bool { + if o != nil && !IsNil(o.IpReservations) { + return true + } + + return false +} + +// SetIpReservations gets a reference to the given []string and assigns it to the IpReservations field. +func (o *IPAddress) SetIpReservations(v []string) { + o.IpReservations = v +} + +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *IPAddress) GetPublic() bool { + if o == nil || IsNil(o.Public) { + var ret bool + return ret + } + return *o.Public +} + +// GetPublicOk returns a tuple with the Public field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAddress) GetPublicOk() (*bool, bool) { + if o == nil || IsNil(o.Public) { + return nil, false + } + return o.Public, true +} + +// HasPublic returns a boolean if a field has been set. +func (o *IPAddress) HasPublic() bool { + if o != nil && !IsNil(o.Public) { + return true + } + + return false +} + +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *IPAddress) SetPublic(v bool) { + o.Public = &v +} + +func (o IPAddress) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPAddress) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AddressFamily) { + toSerialize["address_family"] = o.AddressFamily + } + if !IsNil(o.Cidr) { + toSerialize["cidr"] = o.Cidr + } + if !IsNil(o.IpReservations) { + toSerialize["ip_reservations"] = o.IpReservations + } + if !IsNil(o.Public) { + toSerialize["public"] = o.Public + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IPAddress) UnmarshalJSON(data []byte) (err error) { + varIPAddress := _IPAddress{} + + err = json.Unmarshal(data, &varIPAddress) + + if err != nil { + return err + } + + *o = IPAddress(varIPAddress) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address_family") + delete(additionalProperties, "cidr") + delete(additionalProperties, "ip_reservations") + delete(additionalProperties, "public") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIPAddress struct { + value *IPAddress + isSet bool +} + +func (v NullableIPAddress) Get() *IPAddress { + return v.value +} + +func (v *NullableIPAddress) Set(val *IPAddress) { + v.value = val + v.isSet = true +} + +func (v NullableIPAddress) IsSet() bool { + return v.isSet +} + +func (v *NullableIPAddress) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPAddress(val *IPAddress) *NullableIPAddress { + return &NullableIPAddress{value: val, isSet: true} +} + +func (v NullableIPAddress) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPAddress) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_address_address_family.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_address_address_family.go new file mode 100644 index 00000000..bca64316 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_address_address_family.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// IPAddressAddressFamily Address Family for IP Address +type IPAddressAddressFamily int32 + +// List of IPAddress_address_family +const ( + IPADDRESSADDRESSFAMILY__4 IPAddressAddressFamily = 4 + IPADDRESSADDRESSFAMILY__6 IPAddressAddressFamily = 6 +) + +// All allowed values of IPAddressAddressFamily enum +var AllowedIPAddressAddressFamilyEnumValues = []IPAddressAddressFamily{ + 4, + 6, +} + +func (v *IPAddressAddressFamily) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := IPAddressAddressFamily(value) + for _, existing := range AllowedIPAddressAddressFamilyEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid IPAddressAddressFamily", value) +} + +// NewIPAddressAddressFamilyFromValue returns a pointer to a valid IPAddressAddressFamily +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewIPAddressAddressFamilyFromValue(v int32) (*IPAddressAddressFamily, error) { + ev := IPAddressAddressFamily(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for IPAddressAddressFamily: valid values are %v", v, AllowedIPAddressAddressFamilyEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v IPAddressAddressFamily) IsValid() bool { + for _, existing := range AllowedIPAddressAddressFamilyEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IPAddress_address_family value +func (v IPAddressAddressFamily) Ptr() *IPAddressAddressFamily { + return &v +} + +type NullableIPAddressAddressFamily struct { + value *IPAddressAddressFamily + isSet bool +} + +func (v NullableIPAddressAddressFamily) Get() *IPAddressAddressFamily { + return v.value +} + +func (v *NullableIPAddressAddressFamily) Set(val *IPAddressAddressFamily) { + v.value = val + v.isSet = true +} + +func (v NullableIPAddressAddressFamily) IsSet() bool { + return v.isSet +} + +func (v *NullableIPAddressAddressFamily) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPAddressAddressFamily(val *IPAddressAddressFamily) *NullableIPAddressAddressFamily { + return &NullableIPAddressAddressFamily{value: val, isSet: true} +} + +func (v NullableIPAddressAddressFamily) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPAddressAddressFamily) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment.go new file mode 100644 index 00000000..e5f30700 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment.go @@ -0,0 +1,859 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the IPAssignment type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPAssignment{} + +// IPAssignment struct for IPAssignment +type IPAssignment struct { + Address *string `json:"address,omitempty"` + AddressFamily *int32 `json:"address_family,omitempty"` + AssignedTo *Href `json:"assigned_to,omitempty"` + Cidr *int32 `json:"cidr,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Gateway *string `json:"gateway,omitempty"` + GlobalIp *bool `json:"global_ip,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Manageable *bool `json:"manageable,omitempty"` + Management *bool `json:"management,omitempty"` + Metro *IPAssignmentMetro `json:"metro,omitempty"` + Netmask *string `json:"netmask,omitempty"` + Network *string `json:"network,omitempty"` + ParentBlock *ParentBlock `json:"parent_block,omitempty"` + Public *bool `json:"public,omitempty"` + State *IPAssignmentState `json:"state,omitempty"` + // Only set when this is a Metal Gateway Elastic IP Assignment. The IP address within the Metal Gateway to which requests to the Elastic IP are forwarded. + NextHop *string `json:"next_hop,omitempty"` + Type *IPAssignmentType `json:"type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IPAssignment IPAssignment + +// NewIPAssignment instantiates a new IPAssignment object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPAssignment() *IPAssignment { + this := IPAssignment{} + return &this +} + +// NewIPAssignmentWithDefaults instantiates a new IPAssignment object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPAssignmentWithDefaults() *IPAssignment { + this := IPAssignment{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *IPAssignment) GetAddress() string { + if o == nil || IsNil(o.Address) { + var ret string + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetAddressOk() (*string, bool) { + if o == nil || IsNil(o.Address) { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *IPAssignment) HasAddress() bool { + if o != nil && !IsNil(o.Address) { + return true + } + + return false +} + +// SetAddress gets a reference to the given string and assigns it to the Address field. +func (o *IPAssignment) SetAddress(v string) { + o.Address = &v +} + +// GetAddressFamily returns the AddressFamily field value if set, zero value otherwise. +func (o *IPAssignment) GetAddressFamily() int32 { + if o == nil || IsNil(o.AddressFamily) { + var ret int32 + return ret + } + return *o.AddressFamily +} + +// GetAddressFamilyOk returns a tuple with the AddressFamily field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetAddressFamilyOk() (*int32, bool) { + if o == nil || IsNil(o.AddressFamily) { + return nil, false + } + return o.AddressFamily, true +} + +// HasAddressFamily returns a boolean if a field has been set. +func (o *IPAssignment) HasAddressFamily() bool { + if o != nil && !IsNil(o.AddressFamily) { + return true + } + + return false +} + +// SetAddressFamily gets a reference to the given int32 and assigns it to the AddressFamily field. +func (o *IPAssignment) SetAddressFamily(v int32) { + o.AddressFamily = &v +} + +// GetAssignedTo returns the AssignedTo field value if set, zero value otherwise. +func (o *IPAssignment) GetAssignedTo() Href { + if o == nil || IsNil(o.AssignedTo) { + var ret Href + return ret + } + return *o.AssignedTo +} + +// GetAssignedToOk returns a tuple with the AssignedTo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetAssignedToOk() (*Href, bool) { + if o == nil || IsNil(o.AssignedTo) { + return nil, false + } + return o.AssignedTo, true +} + +// HasAssignedTo returns a boolean if a field has been set. +func (o *IPAssignment) HasAssignedTo() bool { + if o != nil && !IsNil(o.AssignedTo) { + return true + } + + return false +} + +// SetAssignedTo gets a reference to the given Href and assigns it to the AssignedTo field. +func (o *IPAssignment) SetAssignedTo(v Href) { + o.AssignedTo = &v +} + +// GetCidr returns the Cidr field value if set, zero value otherwise. +func (o *IPAssignment) GetCidr() int32 { + if o == nil || IsNil(o.Cidr) { + var ret int32 + return ret + } + return *o.Cidr +} + +// GetCidrOk returns a tuple with the Cidr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetCidrOk() (*int32, bool) { + if o == nil || IsNil(o.Cidr) { + return nil, false + } + return o.Cidr, true +} + +// HasCidr returns a boolean if a field has been set. +func (o *IPAssignment) HasCidr() bool { + if o != nil && !IsNil(o.Cidr) { + return true + } + + return false +} + +// SetCidr gets a reference to the given int32 and assigns it to the Cidr field. +func (o *IPAssignment) SetCidr(v int32) { + o.Cidr = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *IPAssignment) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *IPAssignment) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *IPAssignment) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IPAssignment) GetEnabled() bool { + if o == nil || IsNil(o.Enabled) { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.Enabled) { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IPAssignment) HasEnabled() bool { + if o != nil && !IsNil(o.Enabled) { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IPAssignment) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetGateway returns the Gateway field value if set, zero value otherwise. +func (o *IPAssignment) GetGateway() string { + if o == nil || IsNil(o.Gateway) { + var ret string + return ret + } + return *o.Gateway +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetGatewayOk() (*string, bool) { + if o == nil || IsNil(o.Gateway) { + return nil, false + } + return o.Gateway, true +} + +// HasGateway returns a boolean if a field has been set. +func (o *IPAssignment) HasGateway() bool { + if o != nil && !IsNil(o.Gateway) { + return true + } + + return false +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *IPAssignment) SetGateway(v string) { + o.Gateway = &v +} + +// GetGlobalIp returns the GlobalIp field value if set, zero value otherwise. +func (o *IPAssignment) GetGlobalIp() bool { + if o == nil || IsNil(o.GlobalIp) { + var ret bool + return ret + } + return *o.GlobalIp +} + +// GetGlobalIpOk returns a tuple with the GlobalIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetGlobalIpOk() (*bool, bool) { + if o == nil || IsNil(o.GlobalIp) { + return nil, false + } + return o.GlobalIp, true +} + +// HasGlobalIp returns a boolean if a field has been set. +func (o *IPAssignment) HasGlobalIp() bool { + if o != nil && !IsNil(o.GlobalIp) { + return true + } + + return false +} + +// SetGlobalIp gets a reference to the given bool and assigns it to the GlobalIp field. +func (o *IPAssignment) SetGlobalIp(v bool) { + o.GlobalIp = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *IPAssignment) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *IPAssignment) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *IPAssignment) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *IPAssignment) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *IPAssignment) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *IPAssignment) SetId(v string) { + o.Id = &v +} + +// GetManageable returns the Manageable field value if set, zero value otherwise. +func (o *IPAssignment) GetManageable() bool { + if o == nil || IsNil(o.Manageable) { + var ret bool + return ret + } + return *o.Manageable +} + +// GetManageableOk returns a tuple with the Manageable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetManageableOk() (*bool, bool) { + if o == nil || IsNil(o.Manageable) { + return nil, false + } + return o.Manageable, true +} + +// HasManageable returns a boolean if a field has been set. +func (o *IPAssignment) HasManageable() bool { + if o != nil && !IsNil(o.Manageable) { + return true + } + + return false +} + +// SetManageable gets a reference to the given bool and assigns it to the Manageable field. +func (o *IPAssignment) SetManageable(v bool) { + o.Manageable = &v +} + +// GetManagement returns the Management field value if set, zero value otherwise. +func (o *IPAssignment) GetManagement() bool { + if o == nil || IsNil(o.Management) { + var ret bool + return ret + } + return *o.Management +} + +// GetManagementOk returns a tuple with the Management field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetManagementOk() (*bool, bool) { + if o == nil || IsNil(o.Management) { + return nil, false + } + return o.Management, true +} + +// HasManagement returns a boolean if a field has been set. +func (o *IPAssignment) HasManagement() bool { + if o != nil && !IsNil(o.Management) { + return true + } + + return false +} + +// SetManagement gets a reference to the given bool and assigns it to the Management field. +func (o *IPAssignment) SetManagement(v bool) { + o.Management = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *IPAssignment) GetMetro() IPAssignmentMetro { + if o == nil || IsNil(o.Metro) { + var ret IPAssignmentMetro + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetMetroOk() (*IPAssignmentMetro, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *IPAssignment) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given IPAssignmentMetro and assigns it to the Metro field. +func (o *IPAssignment) SetMetro(v IPAssignmentMetro) { + o.Metro = &v +} + +// GetNetmask returns the Netmask field value if set, zero value otherwise. +func (o *IPAssignment) GetNetmask() string { + if o == nil || IsNil(o.Netmask) { + var ret string + return ret + } + return *o.Netmask +} + +// GetNetmaskOk returns a tuple with the Netmask field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetNetmaskOk() (*string, bool) { + if o == nil || IsNil(o.Netmask) { + return nil, false + } + return o.Netmask, true +} + +// HasNetmask returns a boolean if a field has been set. +func (o *IPAssignment) HasNetmask() bool { + if o != nil && !IsNil(o.Netmask) { + return true + } + + return false +} + +// SetNetmask gets a reference to the given string and assigns it to the Netmask field. +func (o *IPAssignment) SetNetmask(v string) { + o.Netmask = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *IPAssignment) GetNetwork() string { + if o == nil || IsNil(o.Network) { + var ret string + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetNetworkOk() (*string, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *IPAssignment) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given string and assigns it to the Network field. +func (o *IPAssignment) SetNetwork(v string) { + o.Network = &v +} + +// GetParentBlock returns the ParentBlock field value if set, zero value otherwise. +func (o *IPAssignment) GetParentBlock() ParentBlock { + if o == nil || IsNil(o.ParentBlock) { + var ret ParentBlock + return ret + } + return *o.ParentBlock +} + +// GetParentBlockOk returns a tuple with the ParentBlock field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetParentBlockOk() (*ParentBlock, bool) { + if o == nil || IsNil(o.ParentBlock) { + return nil, false + } + return o.ParentBlock, true +} + +// HasParentBlock returns a boolean if a field has been set. +func (o *IPAssignment) HasParentBlock() bool { + if o != nil && !IsNil(o.ParentBlock) { + return true + } + + return false +} + +// SetParentBlock gets a reference to the given ParentBlock and assigns it to the ParentBlock field. +func (o *IPAssignment) SetParentBlock(v ParentBlock) { + o.ParentBlock = &v +} + +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *IPAssignment) GetPublic() bool { + if o == nil || IsNil(o.Public) { + var ret bool + return ret + } + return *o.Public +} + +// GetPublicOk returns a tuple with the Public field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetPublicOk() (*bool, bool) { + if o == nil || IsNil(o.Public) { + return nil, false + } + return o.Public, true +} + +// HasPublic returns a boolean if a field has been set. +func (o *IPAssignment) HasPublic() bool { + if o != nil && !IsNil(o.Public) { + return true + } + + return false +} + +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *IPAssignment) SetPublic(v bool) { + o.Public = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *IPAssignment) GetState() IPAssignmentState { + if o == nil || IsNil(o.State) { + var ret IPAssignmentState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetStateOk() (*IPAssignmentState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *IPAssignment) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given IPAssignmentState and assigns it to the State field. +func (o *IPAssignment) SetState(v IPAssignmentState) { + o.State = &v +} + +// GetNextHop returns the NextHop field value if set, zero value otherwise. +func (o *IPAssignment) GetNextHop() string { + if o == nil || IsNil(o.NextHop) { + var ret string + return ret + } + return *o.NextHop +} + +// GetNextHopOk returns a tuple with the NextHop field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetNextHopOk() (*string, bool) { + if o == nil || IsNil(o.NextHop) { + return nil, false + } + return o.NextHop, true +} + +// HasNextHop returns a boolean if a field has been set. +func (o *IPAssignment) HasNextHop() bool { + if o != nil && !IsNil(o.NextHop) { + return true + } + + return false +} + +// SetNextHop gets a reference to the given string and assigns it to the NextHop field. +func (o *IPAssignment) SetNextHop(v string) { + o.NextHop = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *IPAssignment) GetType() IPAssignmentType { + if o == nil || IsNil(o.Type) { + var ret IPAssignmentType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignment) GetTypeOk() (*IPAssignmentType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *IPAssignment) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given IPAssignmentType and assigns it to the Type field. +func (o *IPAssignment) SetType(v IPAssignmentType) { + o.Type = &v +} + +func (o IPAssignment) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPAssignment) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Address) { + toSerialize["address"] = o.Address + } + if !IsNil(o.AddressFamily) { + toSerialize["address_family"] = o.AddressFamily + } + if !IsNil(o.AssignedTo) { + toSerialize["assigned_to"] = o.AssignedTo + } + if !IsNil(o.Cidr) { + toSerialize["cidr"] = o.Cidr + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + if !IsNil(o.Gateway) { + toSerialize["gateway"] = o.Gateway + } + if !IsNil(o.GlobalIp) { + toSerialize["global_ip"] = o.GlobalIp + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Manageable) { + toSerialize["manageable"] = o.Manageable + } + if !IsNil(o.Management) { + toSerialize["management"] = o.Management + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.Netmask) { + toSerialize["netmask"] = o.Netmask + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.ParentBlock) { + toSerialize["parent_block"] = o.ParentBlock + } + if !IsNil(o.Public) { + toSerialize["public"] = o.Public + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.NextHop) { + toSerialize["next_hop"] = o.NextHop + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IPAssignment) UnmarshalJSON(data []byte) (err error) { + varIPAssignment := _IPAssignment{} + + err = json.Unmarshal(data, &varIPAssignment) + + if err != nil { + return err + } + + *o = IPAssignment(varIPAssignment) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "address_family") + delete(additionalProperties, "assigned_to") + delete(additionalProperties, "cidr") + delete(additionalProperties, "created_at") + delete(additionalProperties, "enabled") + delete(additionalProperties, "gateway") + delete(additionalProperties, "global_ip") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "manageable") + delete(additionalProperties, "management") + delete(additionalProperties, "metro") + delete(additionalProperties, "netmask") + delete(additionalProperties, "network") + delete(additionalProperties, "parent_block") + delete(additionalProperties, "public") + delete(additionalProperties, "state") + delete(additionalProperties, "next_hop") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIPAssignment struct { + value *IPAssignment + isSet bool +} + +func (v NullableIPAssignment) Get() *IPAssignment { + return v.value +} + +func (v *NullableIPAssignment) Set(val *IPAssignment) { + v.value = val + v.isSet = true +} + +func (v NullableIPAssignment) IsSet() bool { + return v.isSet +} + +func (v *NullableIPAssignment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPAssignment(val *IPAssignment) *NullableIPAssignment { + return &NullableIPAssignment{value: val, isSet: true} +} + +func (v NullableIPAssignment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPAssignment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_input.go new file mode 100644 index 00000000..56dab594 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_input.go @@ -0,0 +1,204 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the IPAssignmentInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPAssignmentInput{} + +// IPAssignmentInput struct for IPAssignmentInput +type IPAssignmentInput struct { + Address string `json:"address"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IPAssignmentInput IPAssignmentInput + +// NewIPAssignmentInput instantiates a new IPAssignmentInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPAssignmentInput(address string) *IPAssignmentInput { + this := IPAssignmentInput{} + this.Address = address + return &this +} + +// NewIPAssignmentInputWithDefaults instantiates a new IPAssignmentInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPAssignmentInputWithDefaults() *IPAssignmentInput { + this := IPAssignmentInput{} + return &this +} + +// GetAddress returns the Address field value +func (o *IPAssignmentInput) GetAddress() string { + if o == nil { + var ret string + return ret + } + + return o.Address +} + +// GetAddressOk returns a tuple with the Address field value +// and a boolean to check if the value has been set. +func (o *IPAssignmentInput) GetAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Address, true +} + +// SetAddress sets field value +func (o *IPAssignmentInput) SetAddress(v string) { + o.Address = v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *IPAssignmentInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignmentInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *IPAssignmentInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *IPAssignmentInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +func (o IPAssignmentInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPAssignmentInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["address"] = o.Address + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IPAssignmentInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "address", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIPAssignmentInput := _IPAssignmentInput{} + + err = json.Unmarshal(data, &varIPAssignmentInput) + + if err != nil { + return err + } + + *o = IPAssignmentInput(varIPAssignmentInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "customdata") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIPAssignmentInput struct { + value *IPAssignmentInput + isSet bool +} + +func (v NullableIPAssignmentInput) Get() *IPAssignmentInput { + return v.value +} + +func (v *NullableIPAssignmentInput) Set(val *IPAssignmentInput) { + v.value = val + v.isSet = true +} + +func (v NullableIPAssignmentInput) IsSet() bool { + return v.isSet +} + +func (v *NullableIPAssignmentInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPAssignmentInput(val *IPAssignmentInput) *NullableIPAssignmentInput { + return &NullableIPAssignmentInput{value: val, isSet: true} +} + +func (v NullableIPAssignmentInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPAssignmentInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_list.go new file mode 100644 index 00000000..5632779d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the IPAssignmentList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPAssignmentList{} + +// IPAssignmentList struct for IPAssignmentList +type IPAssignmentList struct { + IpAddresses []IPAssignment `json:"ip_addresses,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IPAssignmentList IPAssignmentList + +// NewIPAssignmentList instantiates a new IPAssignmentList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPAssignmentList() *IPAssignmentList { + this := IPAssignmentList{} + return &this +} + +// NewIPAssignmentListWithDefaults instantiates a new IPAssignmentList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPAssignmentListWithDefaults() *IPAssignmentList { + this := IPAssignmentList{} + return &this +} + +// GetIpAddresses returns the IpAddresses field value if set, zero value otherwise. +func (o *IPAssignmentList) GetIpAddresses() []IPAssignment { + if o == nil || IsNil(o.IpAddresses) { + var ret []IPAssignment + return ret + } + return o.IpAddresses +} + +// GetIpAddressesOk returns a tuple with the IpAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignmentList) GetIpAddressesOk() ([]IPAssignment, bool) { + if o == nil || IsNil(o.IpAddresses) { + return nil, false + } + return o.IpAddresses, true +} + +// HasIpAddresses returns a boolean if a field has been set. +func (o *IPAssignmentList) HasIpAddresses() bool { + if o != nil && !IsNil(o.IpAddresses) { + return true + } + + return false +} + +// SetIpAddresses gets a reference to the given []IPAssignment and assigns it to the IpAddresses field. +func (o *IPAssignmentList) SetIpAddresses(v []IPAssignment) { + o.IpAddresses = v +} + +func (o IPAssignmentList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPAssignmentList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.IpAddresses) { + toSerialize["ip_addresses"] = o.IpAddresses + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IPAssignmentList) UnmarshalJSON(data []byte) (err error) { + varIPAssignmentList := _IPAssignmentList{} + + err = json.Unmarshal(data, &varIPAssignmentList) + + if err != nil { + return err + } + + *o = IPAssignmentList(varIPAssignmentList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ip_addresses") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIPAssignmentList struct { + value *IPAssignmentList + isSet bool +} + +func (v NullableIPAssignmentList) Get() *IPAssignmentList { + return v.value +} + +func (v *NullableIPAssignmentList) Set(val *IPAssignmentList) { + v.value = val + v.isSet = true +} + +func (v NullableIPAssignmentList) IsSet() bool { + return v.isSet +} + +func (v *NullableIPAssignmentList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPAssignmentList(val *IPAssignmentList) *NullableIPAssignmentList { + return &NullableIPAssignmentList{value: val, isSet: true} +} + +func (v NullableIPAssignmentList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPAssignmentList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_metro.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_metro.go new file mode 100644 index 00000000..b99beb93 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_metro.go @@ -0,0 +1,265 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the IPAssignmentMetro type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPAssignmentMetro{} + +// IPAssignmentMetro struct for IPAssignmentMetro +type IPAssignmentMetro struct { + Code *string `json:"code,omitempty"` + Country *string `json:"country,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IPAssignmentMetro IPAssignmentMetro + +// NewIPAssignmentMetro instantiates a new IPAssignmentMetro object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPAssignmentMetro() *IPAssignmentMetro { + this := IPAssignmentMetro{} + return &this +} + +// NewIPAssignmentMetroWithDefaults instantiates a new IPAssignmentMetro object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPAssignmentMetroWithDefaults() *IPAssignmentMetro { + this := IPAssignmentMetro{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *IPAssignmentMetro) GetCode() string { + if o == nil || IsNil(o.Code) { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignmentMetro) GetCodeOk() (*string, bool) { + if o == nil || IsNil(o.Code) { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *IPAssignmentMetro) HasCode() bool { + if o != nil && !IsNil(o.Code) { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *IPAssignmentMetro) SetCode(v string) { + o.Code = &v +} + +// GetCountry returns the Country field value if set, zero value otherwise. +func (o *IPAssignmentMetro) GetCountry() string { + if o == nil || IsNil(o.Country) { + var ret string + return ret + } + return *o.Country +} + +// GetCountryOk returns a tuple with the Country field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignmentMetro) GetCountryOk() (*string, bool) { + if o == nil || IsNil(o.Country) { + return nil, false + } + return o.Country, true +} + +// HasCountry returns a boolean if a field has been set. +func (o *IPAssignmentMetro) HasCountry() bool { + if o != nil && !IsNil(o.Country) { + return true + } + + return false +} + +// SetCountry gets a reference to the given string and assigns it to the Country field. +func (o *IPAssignmentMetro) SetCountry(v string) { + o.Country = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *IPAssignmentMetro) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignmentMetro) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *IPAssignmentMetro) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *IPAssignmentMetro) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *IPAssignmentMetro) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignmentMetro) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *IPAssignmentMetro) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *IPAssignmentMetro) SetName(v string) { + o.Name = &v +} + +func (o IPAssignmentMetro) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPAssignmentMetro) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Code) { + toSerialize["code"] = o.Code + } + if !IsNil(o.Country) { + toSerialize["country"] = o.Country + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IPAssignmentMetro) UnmarshalJSON(data []byte) (err error) { + varIPAssignmentMetro := _IPAssignmentMetro{} + + err = json.Unmarshal(data, &varIPAssignmentMetro) + + if err != nil { + return err + } + + *o = IPAssignmentMetro(varIPAssignmentMetro) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "country") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIPAssignmentMetro struct { + value *IPAssignmentMetro + isSet bool +} + +func (v NullableIPAssignmentMetro) Get() *IPAssignmentMetro { + return v.value +} + +func (v *NullableIPAssignmentMetro) Set(val *IPAssignmentMetro) { + v.value = val + v.isSet = true +} + +func (v NullableIPAssignmentMetro) IsSet() bool { + return v.isSet +} + +func (v *NullableIPAssignmentMetro) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPAssignmentMetro(val *IPAssignmentMetro) *NullableIPAssignmentMetro { + return &NullableIPAssignmentMetro{value: val, isSet: true} +} + +func (v NullableIPAssignmentMetro) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPAssignmentMetro) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_state.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_state.go new file mode 100644 index 00000000..608c140b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_state.go @@ -0,0 +1,113 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// IPAssignmentState Only set when this is a Metal Gateway Elastic IP Assignment. Describes the current configuration state of this IP on the network. +type IPAssignmentState string + +// List of IPAssignment_state +const ( + IPASSIGNMENTSTATE_PENDING IPAssignmentState = "pending" + IPASSIGNMENTSTATE_ACTIVE IPAssignmentState = "active" + IPASSIGNMENTSTATE_DELETING IPAssignmentState = "deleting" +) + +// All allowed values of IPAssignmentState enum +var AllowedIPAssignmentStateEnumValues = []IPAssignmentState{ + "pending", + "active", + "deleting", +} + +func (v *IPAssignmentState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := IPAssignmentState(value) + for _, existing := range AllowedIPAssignmentStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid IPAssignmentState", value) +} + +// NewIPAssignmentStateFromValue returns a pointer to a valid IPAssignmentState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewIPAssignmentStateFromValue(v string) (*IPAssignmentState, error) { + ev := IPAssignmentState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for IPAssignmentState: valid values are %v", v, AllowedIPAssignmentStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v IPAssignmentState) IsValid() bool { + for _, existing := range AllowedIPAssignmentStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IPAssignment_state value +func (v IPAssignmentState) Ptr() *IPAssignmentState { + return &v +} + +type NullableIPAssignmentState struct { + value *IPAssignmentState + isSet bool +} + +func (v NullableIPAssignmentState) Get() *IPAssignmentState { + return v.value +} + +func (v *NullableIPAssignmentState) Set(val *IPAssignmentState) { + v.value = val + v.isSet = true +} + +func (v NullableIPAssignmentState) IsSet() bool { + return v.isSet +} + +func (v *NullableIPAssignmentState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPAssignmentState(val *IPAssignmentState) *NullableIPAssignmentState { + return &NullableIPAssignmentState{value: val, isSet: true} +} + +func (v NullableIPAssignmentState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPAssignmentState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_type.go new file mode 100644 index 00000000..d2c34cd3 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_type.go @@ -0,0 +1,109 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// IPAssignmentType the model 'IPAssignmentType' +type IPAssignmentType string + +// List of IPAssignment_type +const ( + IPASSIGNMENTTYPE_IP_ASSIGNMENT IPAssignmentType = "IPAssignment" +) + +// All allowed values of IPAssignmentType enum +var AllowedIPAssignmentTypeEnumValues = []IPAssignmentType{ + "IPAssignment", +} + +func (v *IPAssignmentType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := IPAssignmentType(value) + for _, existing := range AllowedIPAssignmentTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid IPAssignmentType", value) +} + +// NewIPAssignmentTypeFromValue returns a pointer to a valid IPAssignmentType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewIPAssignmentTypeFromValue(v string) (*IPAssignmentType, error) { + ev := IPAssignmentType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for IPAssignmentType: valid values are %v", v, AllowedIPAssignmentTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v IPAssignmentType) IsValid() bool { + for _, existing := range AllowedIPAssignmentTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IPAssignment_type value +func (v IPAssignmentType) Ptr() *IPAssignmentType { + return &v +} + +type NullableIPAssignmentType struct { + value *IPAssignmentType + isSet bool +} + +func (v NullableIPAssignmentType) Get() *IPAssignmentType { + return v.value +} + +func (v *NullableIPAssignmentType) Set(val *IPAssignmentType) { + v.value = val + v.isSet = true +} + +func (v NullableIPAssignmentType) IsSet() bool { + return v.isSet +} + +func (v *NullableIPAssignmentType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPAssignmentType(val *IPAssignmentType) *NullableIPAssignmentType { + return &NullableIPAssignmentType{value: val, isSet: true} +} + +func (v NullableIPAssignmentType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPAssignmentType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_update_input.go new file mode 100644 index 00000000..4a1497c7 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_assignment_update_input.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the IPAssignmentUpdateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPAssignmentUpdateInput{} + +// IPAssignmentUpdateInput struct for IPAssignmentUpdateInput +type IPAssignmentUpdateInput struct { + Details *string `json:"details,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IPAssignmentUpdateInput IPAssignmentUpdateInput + +// NewIPAssignmentUpdateInput instantiates a new IPAssignmentUpdateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPAssignmentUpdateInput() *IPAssignmentUpdateInput { + this := IPAssignmentUpdateInput{} + return &this +} + +// NewIPAssignmentUpdateInputWithDefaults instantiates a new IPAssignmentUpdateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPAssignmentUpdateInputWithDefaults() *IPAssignmentUpdateInput { + this := IPAssignmentUpdateInput{} + return &this +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *IPAssignmentUpdateInput) GetDetails() string { + if o == nil || IsNil(o.Details) { + var ret string + return ret + } + return *o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignmentUpdateInput) GetDetailsOk() (*string, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *IPAssignmentUpdateInput) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *IPAssignmentUpdateInput) SetDetails(v string) { + o.Details = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *IPAssignmentUpdateInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignmentUpdateInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *IPAssignmentUpdateInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *IPAssignmentUpdateInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *IPAssignmentUpdateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAssignmentUpdateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *IPAssignmentUpdateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *IPAssignmentUpdateInput) SetTags(v []string) { + o.Tags = v +} + +func (o IPAssignmentUpdateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPAssignmentUpdateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IPAssignmentUpdateInput) UnmarshalJSON(data []byte) (err error) { + varIPAssignmentUpdateInput := _IPAssignmentUpdateInput{} + + err = json.Unmarshal(data, &varIPAssignmentUpdateInput) + + if err != nil { + return err + } + + *o = IPAssignmentUpdateInput(varIPAssignmentUpdateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "details") + delete(additionalProperties, "customdata") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIPAssignmentUpdateInput struct { + value *IPAssignmentUpdateInput + isSet bool +} + +func (v NullableIPAssignmentUpdateInput) Get() *IPAssignmentUpdateInput { + return v.value +} + +func (v *NullableIPAssignmentUpdateInput) Set(val *IPAssignmentUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullableIPAssignmentUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableIPAssignmentUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPAssignmentUpdateInput(val *IPAssignmentUpdateInput) *NullableIPAssignmentUpdateInput { + return &NullableIPAssignmentUpdateInput{value: val, isSet: true} +} + +func (v NullableIPAssignmentUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPAssignmentUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_availabilities_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_availabilities_list.go new file mode 100644 index 00000000..23c9a679 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_availabilities_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the IPAvailabilitiesList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPAvailabilitiesList{} + +// IPAvailabilitiesList struct for IPAvailabilitiesList +type IPAvailabilitiesList struct { + Available []string `json:"available,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IPAvailabilitiesList IPAvailabilitiesList + +// NewIPAvailabilitiesList instantiates a new IPAvailabilitiesList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPAvailabilitiesList() *IPAvailabilitiesList { + this := IPAvailabilitiesList{} + return &this +} + +// NewIPAvailabilitiesListWithDefaults instantiates a new IPAvailabilitiesList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPAvailabilitiesListWithDefaults() *IPAvailabilitiesList { + this := IPAvailabilitiesList{} + return &this +} + +// GetAvailable returns the Available field value if set, zero value otherwise. +func (o *IPAvailabilitiesList) GetAvailable() []string { + if o == nil || IsNil(o.Available) { + var ret []string + return ret + } + return o.Available +} + +// GetAvailableOk returns a tuple with the Available field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPAvailabilitiesList) GetAvailableOk() ([]string, bool) { + if o == nil || IsNil(o.Available) { + return nil, false + } + return o.Available, true +} + +// HasAvailable returns a boolean if a field has been set. +func (o *IPAvailabilitiesList) HasAvailable() bool { + if o != nil && !IsNil(o.Available) { + return true + } + + return false +} + +// SetAvailable gets a reference to the given []string and assigns it to the Available field. +func (o *IPAvailabilitiesList) SetAvailable(v []string) { + o.Available = v +} + +func (o IPAvailabilitiesList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPAvailabilitiesList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Available) { + toSerialize["available"] = o.Available + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IPAvailabilitiesList) UnmarshalJSON(data []byte) (err error) { + varIPAvailabilitiesList := _IPAvailabilitiesList{} + + err = json.Unmarshal(data, &varIPAvailabilitiesList) + + if err != nil { + return err + } + + *o = IPAvailabilitiesList(varIPAvailabilitiesList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "available") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIPAvailabilitiesList struct { + value *IPAvailabilitiesList + isSet bool +} + +func (v NullableIPAvailabilitiesList) Get() *IPAvailabilitiesList { + return v.value +} + +func (v *NullableIPAvailabilitiesList) Set(val *IPAvailabilitiesList) { + v.value = val + v.isSet = true +} + +func (v NullableIPAvailabilitiesList) IsSet() bool { + return v.isSet +} + +func (v *NullableIPAvailabilitiesList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPAvailabilitiesList(val *IPAvailabilitiesList) *NullableIPAvailabilitiesList { + return &NullableIPAvailabilitiesList{value: val, isSet: true} +} + +func (v NullableIPAvailabilitiesList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPAvailabilitiesList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation.go new file mode 100644 index 00000000..6971bb2a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation.go @@ -0,0 +1,1166 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "bytes" + "encoding/json" + "fmt" + "time" +) + +// checks if the IPReservation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPReservation{} + +// IPReservation struct for IPReservation +type IPReservation struct { + Addon *bool `json:"addon,omitempty"` + Address *string `json:"address,omitempty"` + AddressFamily *int32 `json:"address_family,omitempty"` + Assignments []IPAssignment `json:"assignments,omitempty"` + Available *string `json:"available,omitempty"` + Bill *bool `json:"bill,omitempty"` + Cidr *int32 `json:"cidr,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Details *string `json:"details,omitempty"` + Facility *IPReservationFacility `json:"facility,omitempty"` + Gateway *string `json:"gateway,omitempty"` + GlobalIp *bool `json:"global_ip,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Manageable *bool `json:"manageable,omitempty"` + Management *bool `json:"management,omitempty"` + MetalGateway *MetalGatewayLite `json:"metal_gateway,omitempty"` + Metro *IPReservationMetro `json:"metro,omitempty"` + Netmask *string `json:"netmask,omitempty"` + Network *string `json:"network,omitempty"` + Project *Project `json:"project,omitempty"` + ProjectLite *Href `json:"project_lite,omitempty"` + RequestedBy *Href `json:"requested_by,omitempty"` + Public *bool `json:"public,omitempty"` + State *string `json:"state,omitempty"` + Tags []string `json:"tags,omitempty"` + Type IPReservationType `json:"type"` +} + +type _IPReservation IPReservation + +// NewIPReservation instantiates a new IPReservation object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPReservation(type_ IPReservationType) *IPReservation { + this := IPReservation{} + this.Type = type_ + return &this +} + +// NewIPReservationWithDefaults instantiates a new IPReservation object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPReservationWithDefaults() *IPReservation { + this := IPReservation{} + return &this +} + +// GetAddon returns the Addon field value if set, zero value otherwise. +func (o *IPReservation) GetAddon() bool { + if o == nil || IsNil(o.Addon) { + var ret bool + return ret + } + return *o.Addon +} + +// GetAddonOk returns a tuple with the Addon field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetAddonOk() (*bool, bool) { + if o == nil || IsNil(o.Addon) { + return nil, false + } + return o.Addon, true +} + +// HasAddon returns a boolean if a field has been set. +func (o *IPReservation) HasAddon() bool { + if o != nil && !IsNil(o.Addon) { + return true + } + + return false +} + +// SetAddon gets a reference to the given bool and assigns it to the Addon field. +func (o *IPReservation) SetAddon(v bool) { + o.Addon = &v +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *IPReservation) GetAddress() string { + if o == nil || IsNil(o.Address) { + var ret string + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetAddressOk() (*string, bool) { + if o == nil || IsNil(o.Address) { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *IPReservation) HasAddress() bool { + if o != nil && !IsNil(o.Address) { + return true + } + + return false +} + +// SetAddress gets a reference to the given string and assigns it to the Address field. +func (o *IPReservation) SetAddress(v string) { + o.Address = &v +} + +// GetAddressFamily returns the AddressFamily field value if set, zero value otherwise. +func (o *IPReservation) GetAddressFamily() int32 { + if o == nil || IsNil(o.AddressFamily) { + var ret int32 + return ret + } + return *o.AddressFamily +} + +// GetAddressFamilyOk returns a tuple with the AddressFamily field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetAddressFamilyOk() (*int32, bool) { + if o == nil || IsNil(o.AddressFamily) { + return nil, false + } + return o.AddressFamily, true +} + +// HasAddressFamily returns a boolean if a field has been set. +func (o *IPReservation) HasAddressFamily() bool { + if o != nil && !IsNil(o.AddressFamily) { + return true + } + + return false +} + +// SetAddressFamily gets a reference to the given int32 and assigns it to the AddressFamily field. +func (o *IPReservation) SetAddressFamily(v int32) { + o.AddressFamily = &v +} + +// GetAssignments returns the Assignments field value if set, zero value otherwise. +func (o *IPReservation) GetAssignments() []IPAssignment { + if o == nil || IsNil(o.Assignments) { + var ret []IPAssignment + return ret + } + return o.Assignments +} + +// GetAssignmentsOk returns a tuple with the Assignments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetAssignmentsOk() ([]IPAssignment, bool) { + if o == nil || IsNil(o.Assignments) { + return nil, false + } + return o.Assignments, true +} + +// HasAssignments returns a boolean if a field has been set. +func (o *IPReservation) HasAssignments() bool { + if o != nil && !IsNil(o.Assignments) { + return true + } + + return false +} + +// SetAssignments gets a reference to the given []IPAssignment and assigns it to the Assignments field. +func (o *IPReservation) SetAssignments(v []IPAssignment) { + o.Assignments = v +} + +// GetAvailable returns the Available field value if set, zero value otherwise. +func (o *IPReservation) GetAvailable() string { + if o == nil || IsNil(o.Available) { + var ret string + return ret + } + return *o.Available +} + +// GetAvailableOk returns a tuple with the Available field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetAvailableOk() (*string, bool) { + if o == nil || IsNil(o.Available) { + return nil, false + } + return o.Available, true +} + +// HasAvailable returns a boolean if a field has been set. +func (o *IPReservation) HasAvailable() bool { + if o != nil && !IsNil(o.Available) { + return true + } + + return false +} + +// SetAvailable gets a reference to the given string and assigns it to the Available field. +func (o *IPReservation) SetAvailable(v string) { + o.Available = &v +} + +// GetBill returns the Bill field value if set, zero value otherwise. +func (o *IPReservation) GetBill() bool { + if o == nil || IsNil(o.Bill) { + var ret bool + return ret + } + return *o.Bill +} + +// GetBillOk returns a tuple with the Bill field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetBillOk() (*bool, bool) { + if o == nil || IsNil(o.Bill) { + return nil, false + } + return o.Bill, true +} + +// HasBill returns a boolean if a field has been set. +func (o *IPReservation) HasBill() bool { + if o != nil && !IsNil(o.Bill) { + return true + } + + return false +} + +// SetBill gets a reference to the given bool and assigns it to the Bill field. +func (o *IPReservation) SetBill(v bool) { + o.Bill = &v +} + +// GetCidr returns the Cidr field value if set, zero value otherwise. +func (o *IPReservation) GetCidr() int32 { + if o == nil || IsNil(o.Cidr) { + var ret int32 + return ret + } + return *o.Cidr +} + +// GetCidrOk returns a tuple with the Cidr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetCidrOk() (*int32, bool) { + if o == nil || IsNil(o.Cidr) { + return nil, false + } + return o.Cidr, true +} + +// HasCidr returns a boolean if a field has been set. +func (o *IPReservation) HasCidr() bool { + if o != nil && !IsNil(o.Cidr) { + return true + } + + return false +} + +// SetCidr gets a reference to the given int32 and assigns it to the Cidr field. +func (o *IPReservation) SetCidr(v int32) { + o.Cidr = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *IPReservation) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *IPReservation) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *IPReservation) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *IPReservation) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *IPReservation) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *IPReservation) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IPReservation) GetEnabled() bool { + if o == nil || IsNil(o.Enabled) { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.Enabled) { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IPReservation) HasEnabled() bool { + if o != nil && !IsNil(o.Enabled) { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IPReservation) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *IPReservation) GetDetails() string { + if o == nil || IsNil(o.Details) { + var ret string + return ret + } + return *o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetDetailsOk() (*string, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *IPReservation) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *IPReservation) SetDetails(v string) { + o.Details = &v +} + +// GetFacility returns the Facility field value if set, zero value otherwise. +func (o *IPReservation) GetFacility() IPReservationFacility { + if o == nil || IsNil(o.Facility) { + var ret IPReservationFacility + return ret + } + return *o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetFacilityOk() (*IPReservationFacility, bool) { + if o == nil || IsNil(o.Facility) { + return nil, false + } + return o.Facility, true +} + +// HasFacility returns a boolean if a field has been set. +func (o *IPReservation) HasFacility() bool { + if o != nil && !IsNil(o.Facility) { + return true + } + + return false +} + +// SetFacility gets a reference to the given IPReservationFacility and assigns it to the Facility field. +func (o *IPReservation) SetFacility(v IPReservationFacility) { + o.Facility = &v +} + +// GetGateway returns the Gateway field value if set, zero value otherwise. +func (o *IPReservation) GetGateway() string { + if o == nil || IsNil(o.Gateway) { + var ret string + return ret + } + return *o.Gateway +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetGatewayOk() (*string, bool) { + if o == nil || IsNil(o.Gateway) { + return nil, false + } + return o.Gateway, true +} + +// HasGateway returns a boolean if a field has been set. +func (o *IPReservation) HasGateway() bool { + if o != nil && !IsNil(o.Gateway) { + return true + } + + return false +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *IPReservation) SetGateway(v string) { + o.Gateway = &v +} + +// GetGlobalIp returns the GlobalIp field value if set, zero value otherwise. +func (o *IPReservation) GetGlobalIp() bool { + if o == nil || IsNil(o.GlobalIp) { + var ret bool + return ret + } + return *o.GlobalIp +} + +// GetGlobalIpOk returns a tuple with the GlobalIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetGlobalIpOk() (*bool, bool) { + if o == nil || IsNil(o.GlobalIp) { + return nil, false + } + return o.GlobalIp, true +} + +// HasGlobalIp returns a boolean if a field has been set. +func (o *IPReservation) HasGlobalIp() bool { + if o != nil && !IsNil(o.GlobalIp) { + return true + } + + return false +} + +// SetGlobalIp gets a reference to the given bool and assigns it to the GlobalIp field. +func (o *IPReservation) SetGlobalIp(v bool) { + o.GlobalIp = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *IPReservation) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *IPReservation) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *IPReservation) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *IPReservation) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *IPReservation) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *IPReservation) SetId(v string) { + o.Id = &v +} + +// GetManageable returns the Manageable field value if set, zero value otherwise. +func (o *IPReservation) GetManageable() bool { + if o == nil || IsNil(o.Manageable) { + var ret bool + return ret + } + return *o.Manageable +} + +// GetManageableOk returns a tuple with the Manageable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetManageableOk() (*bool, bool) { + if o == nil || IsNil(o.Manageable) { + return nil, false + } + return o.Manageable, true +} + +// HasManageable returns a boolean if a field has been set. +func (o *IPReservation) HasManageable() bool { + if o != nil && !IsNil(o.Manageable) { + return true + } + + return false +} + +// SetManageable gets a reference to the given bool and assigns it to the Manageable field. +func (o *IPReservation) SetManageable(v bool) { + o.Manageable = &v +} + +// GetManagement returns the Management field value if set, zero value otherwise. +func (o *IPReservation) GetManagement() bool { + if o == nil || IsNil(o.Management) { + var ret bool + return ret + } + return *o.Management +} + +// GetManagementOk returns a tuple with the Management field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetManagementOk() (*bool, bool) { + if o == nil || IsNil(o.Management) { + return nil, false + } + return o.Management, true +} + +// HasManagement returns a boolean if a field has been set. +func (o *IPReservation) HasManagement() bool { + if o != nil && !IsNil(o.Management) { + return true + } + + return false +} + +// SetManagement gets a reference to the given bool and assigns it to the Management field. +func (o *IPReservation) SetManagement(v bool) { + o.Management = &v +} + +// GetMetalGateway returns the MetalGateway field value if set, zero value otherwise. +func (o *IPReservation) GetMetalGateway() MetalGatewayLite { + if o == nil || IsNil(o.MetalGateway) { + var ret MetalGatewayLite + return ret + } + return *o.MetalGateway +} + +// GetMetalGatewayOk returns a tuple with the MetalGateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetMetalGatewayOk() (*MetalGatewayLite, bool) { + if o == nil || IsNil(o.MetalGateway) { + return nil, false + } + return o.MetalGateway, true +} + +// HasMetalGateway returns a boolean if a field has been set. +func (o *IPReservation) HasMetalGateway() bool { + if o != nil && !IsNil(o.MetalGateway) { + return true + } + + return false +} + +// SetMetalGateway gets a reference to the given MetalGatewayLite and assigns it to the MetalGateway field. +func (o *IPReservation) SetMetalGateway(v MetalGatewayLite) { + o.MetalGateway = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *IPReservation) GetMetro() IPReservationMetro { + if o == nil || IsNil(o.Metro) { + var ret IPReservationMetro + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetMetroOk() (*IPReservationMetro, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *IPReservation) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given IPReservationMetro and assigns it to the Metro field. +func (o *IPReservation) SetMetro(v IPReservationMetro) { + o.Metro = &v +} + +// GetNetmask returns the Netmask field value if set, zero value otherwise. +func (o *IPReservation) GetNetmask() string { + if o == nil || IsNil(o.Netmask) { + var ret string + return ret + } + return *o.Netmask +} + +// GetNetmaskOk returns a tuple with the Netmask field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetNetmaskOk() (*string, bool) { + if o == nil || IsNil(o.Netmask) { + return nil, false + } + return o.Netmask, true +} + +// HasNetmask returns a boolean if a field has been set. +func (o *IPReservation) HasNetmask() bool { + if o != nil && !IsNil(o.Netmask) { + return true + } + + return false +} + +// SetNetmask gets a reference to the given string and assigns it to the Netmask field. +func (o *IPReservation) SetNetmask(v string) { + o.Netmask = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *IPReservation) GetNetwork() string { + if o == nil || IsNil(o.Network) { + var ret string + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetNetworkOk() (*string, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *IPReservation) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given string and assigns it to the Network field. +func (o *IPReservation) SetNetwork(v string) { + o.Network = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *IPReservation) GetProject() Project { + if o == nil || IsNil(o.Project) { + var ret Project + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetProjectOk() (*Project, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *IPReservation) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Project and assigns it to the Project field. +func (o *IPReservation) SetProject(v Project) { + o.Project = &v +} + +// GetProjectLite returns the ProjectLite field value if set, zero value otherwise. +func (o *IPReservation) GetProjectLite() Href { + if o == nil || IsNil(o.ProjectLite) { + var ret Href + return ret + } + return *o.ProjectLite +} + +// GetProjectLiteOk returns a tuple with the ProjectLite field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetProjectLiteOk() (*Href, bool) { + if o == nil || IsNil(o.ProjectLite) { + return nil, false + } + return o.ProjectLite, true +} + +// HasProjectLite returns a boolean if a field has been set. +func (o *IPReservation) HasProjectLite() bool { + if o != nil && !IsNil(o.ProjectLite) { + return true + } + + return false +} + +// SetProjectLite gets a reference to the given Href and assigns it to the ProjectLite field. +func (o *IPReservation) SetProjectLite(v Href) { + o.ProjectLite = &v +} + +// GetRequestedBy returns the RequestedBy field value if set, zero value otherwise. +func (o *IPReservation) GetRequestedBy() Href { + if o == nil || IsNil(o.RequestedBy) { + var ret Href + return ret + } + return *o.RequestedBy +} + +// GetRequestedByOk returns a tuple with the RequestedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetRequestedByOk() (*Href, bool) { + if o == nil || IsNil(o.RequestedBy) { + return nil, false + } + return o.RequestedBy, true +} + +// HasRequestedBy returns a boolean if a field has been set. +func (o *IPReservation) HasRequestedBy() bool { + if o != nil && !IsNil(o.RequestedBy) { + return true + } + + return false +} + +// SetRequestedBy gets a reference to the given Href and assigns it to the RequestedBy field. +func (o *IPReservation) SetRequestedBy(v Href) { + o.RequestedBy = &v +} + +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *IPReservation) GetPublic() bool { + if o == nil || IsNil(o.Public) { + var ret bool + return ret + } + return *o.Public +} + +// GetPublicOk returns a tuple with the Public field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetPublicOk() (*bool, bool) { + if o == nil || IsNil(o.Public) { + return nil, false + } + return o.Public, true +} + +// HasPublic returns a boolean if a field has been set. +func (o *IPReservation) HasPublic() bool { + if o != nil && !IsNil(o.Public) { + return true + } + + return false +} + +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *IPReservation) SetPublic(v bool) { + o.Public = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *IPReservation) GetState() string { + if o == nil || IsNil(o.State) { + var ret string + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetStateOk() (*string, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *IPReservation) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *IPReservation) SetState(v string) { + o.State = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *IPReservation) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservation) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *IPReservation) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *IPReservation) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value +func (o *IPReservation) GetType() IPReservationType { + if o == nil { + var ret IPReservationType + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IPReservation) GetTypeOk() (*IPReservationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *IPReservation) SetType(v IPReservationType) { + o.Type = v +} + +func (o IPReservation) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPReservation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Addon) { + toSerialize["addon"] = o.Addon + } + if !IsNil(o.Address) { + toSerialize["address"] = o.Address + } + if !IsNil(o.AddressFamily) { + toSerialize["address_family"] = o.AddressFamily + } + if !IsNil(o.Assignments) { + toSerialize["assignments"] = o.Assignments + } + if !IsNil(o.Available) { + toSerialize["available"] = o.Available + } + if !IsNil(o.Bill) { + toSerialize["bill"] = o.Bill + } + if !IsNil(o.Cidr) { + toSerialize["cidr"] = o.Cidr + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + if !IsNil(o.Facility) { + toSerialize["facility"] = o.Facility + } + if !IsNil(o.Gateway) { + toSerialize["gateway"] = o.Gateway + } + if !IsNil(o.GlobalIp) { + toSerialize["global_ip"] = o.GlobalIp + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Manageable) { + toSerialize["manageable"] = o.Manageable + } + if !IsNil(o.Management) { + toSerialize["management"] = o.Management + } + if !IsNil(o.MetalGateway) { + toSerialize["metal_gateway"] = o.MetalGateway + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.Netmask) { + toSerialize["netmask"] = o.Netmask + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.ProjectLite) { + toSerialize["project_lite"] = o.ProjectLite + } + if !IsNil(o.RequestedBy) { + toSerialize["requested_by"] = o.RequestedBy + } + if !IsNil(o.Public) { + toSerialize["public"] = o.Public + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + toSerialize["type"] = o.Type + return toSerialize, nil +} + +func (o *IPReservation) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIPReservation := _IPReservation{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIPReservation) + + if err != nil { + return err + } + + *o = IPReservation(varIPReservation) + + return err +} + +type NullableIPReservation struct { + value *IPReservation + isSet bool +} + +func (v NullableIPReservation) Get() *IPReservation { + return v.value +} + +func (v *NullableIPReservation) Set(val *IPReservation) { + v.value = val + v.isSet = true +} + +func (v NullableIPReservation) IsSet() bool { + return v.isSet +} + +func (v *NullableIPReservation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPReservation(val *IPReservation) *NullableIPReservation { + return &NullableIPReservation{value: val, isSet: true} +} + +func (v NullableIPReservation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPReservation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_facility.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_facility.go new file mode 100644 index 00000000..06ad05a4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_facility.go @@ -0,0 +1,377 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the IPReservationFacility type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPReservationFacility{} + +// IPReservationFacility struct for IPReservationFacility +type IPReservationFacility struct { + Address *Address `json:"address,omitempty"` + Code *string `json:"code,omitempty"` + Features []FacilityFeaturesInner `json:"features,omitempty"` + Id *string `json:"id,omitempty"` + // IP ranges registered in facility. Can be used for GeoIP location + IpRanges []string `json:"ip_ranges,omitempty"` + Metro *DeviceMetro `json:"metro,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IPReservationFacility IPReservationFacility + +// NewIPReservationFacility instantiates a new IPReservationFacility object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPReservationFacility() *IPReservationFacility { + this := IPReservationFacility{} + return &this +} + +// NewIPReservationFacilityWithDefaults instantiates a new IPReservationFacility object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPReservationFacilityWithDefaults() *IPReservationFacility { + this := IPReservationFacility{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *IPReservationFacility) GetAddress() Address { + if o == nil || IsNil(o.Address) { + var ret Address + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationFacility) GetAddressOk() (*Address, bool) { + if o == nil || IsNil(o.Address) { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *IPReservationFacility) HasAddress() bool { + if o != nil && !IsNil(o.Address) { + return true + } + + return false +} + +// SetAddress gets a reference to the given Address and assigns it to the Address field. +func (o *IPReservationFacility) SetAddress(v Address) { + o.Address = &v +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *IPReservationFacility) GetCode() string { + if o == nil || IsNil(o.Code) { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationFacility) GetCodeOk() (*string, bool) { + if o == nil || IsNil(o.Code) { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *IPReservationFacility) HasCode() bool { + if o != nil && !IsNil(o.Code) { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *IPReservationFacility) SetCode(v string) { + o.Code = &v +} + +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *IPReservationFacility) GetFeatures() []FacilityFeaturesInner { + if o == nil || IsNil(o.Features) { + var ret []FacilityFeaturesInner + return ret + } + return o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationFacility) GetFeaturesOk() ([]FacilityFeaturesInner, bool) { + if o == nil || IsNil(o.Features) { + return nil, false + } + return o.Features, true +} + +// HasFeatures returns a boolean if a field has been set. +func (o *IPReservationFacility) HasFeatures() bool { + if o != nil && !IsNil(o.Features) { + return true + } + + return false +} + +// SetFeatures gets a reference to the given []FacilityFeaturesInner and assigns it to the Features field. +func (o *IPReservationFacility) SetFeatures(v []FacilityFeaturesInner) { + o.Features = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *IPReservationFacility) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationFacility) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *IPReservationFacility) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *IPReservationFacility) SetId(v string) { + o.Id = &v +} + +// GetIpRanges returns the IpRanges field value if set, zero value otherwise. +func (o *IPReservationFacility) GetIpRanges() []string { + if o == nil || IsNil(o.IpRanges) { + var ret []string + return ret + } + return o.IpRanges +} + +// GetIpRangesOk returns a tuple with the IpRanges field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationFacility) GetIpRangesOk() ([]string, bool) { + if o == nil || IsNil(o.IpRanges) { + return nil, false + } + return o.IpRanges, true +} + +// HasIpRanges returns a boolean if a field has been set. +func (o *IPReservationFacility) HasIpRanges() bool { + if o != nil && !IsNil(o.IpRanges) { + return true + } + + return false +} + +// SetIpRanges gets a reference to the given []string and assigns it to the IpRanges field. +func (o *IPReservationFacility) SetIpRanges(v []string) { + o.IpRanges = v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *IPReservationFacility) GetMetro() DeviceMetro { + if o == nil || IsNil(o.Metro) { + var ret DeviceMetro + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationFacility) GetMetroOk() (*DeviceMetro, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *IPReservationFacility) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given DeviceMetro and assigns it to the Metro field. +func (o *IPReservationFacility) SetMetro(v DeviceMetro) { + o.Metro = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *IPReservationFacility) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationFacility) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *IPReservationFacility) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *IPReservationFacility) SetName(v string) { + o.Name = &v +} + +func (o IPReservationFacility) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPReservationFacility) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Address) { + toSerialize["address"] = o.Address + } + if !IsNil(o.Code) { + toSerialize["code"] = o.Code + } + if !IsNil(o.Features) { + toSerialize["features"] = o.Features + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.IpRanges) { + toSerialize["ip_ranges"] = o.IpRanges + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IPReservationFacility) UnmarshalJSON(data []byte) (err error) { + varIPReservationFacility := _IPReservationFacility{} + + err = json.Unmarshal(data, &varIPReservationFacility) + + if err != nil { + return err + } + + *o = IPReservationFacility(varIPReservationFacility) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "code") + delete(additionalProperties, "features") + delete(additionalProperties, "id") + delete(additionalProperties, "ip_ranges") + delete(additionalProperties, "metro") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIPReservationFacility struct { + value *IPReservationFacility + isSet bool +} + +func (v NullableIPReservationFacility) Get() *IPReservationFacility { + return v.value +} + +func (v *NullableIPReservationFacility) Set(val *IPReservationFacility) { + v.value = val + v.isSet = true +} + +func (v NullableIPReservationFacility) IsSet() bool { + return v.isSet +} + +func (v *NullableIPReservationFacility) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPReservationFacility(val *IPReservationFacility) *NullableIPReservationFacility { + return &NullableIPReservationFacility{value: val, isSet: true} +} + +func (v NullableIPReservationFacility) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPReservationFacility) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_list.go new file mode 100644 index 00000000..86830176 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_list.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the IPReservationList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPReservationList{} + +// IPReservationList struct for IPReservationList +type IPReservationList struct { + IpAddresses []IPReservationListIpAddressesInner `json:"ip_addresses,omitempty"` + Meta *Meta `json:"meta,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IPReservationList IPReservationList + +// NewIPReservationList instantiates a new IPReservationList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPReservationList() *IPReservationList { + this := IPReservationList{} + return &this +} + +// NewIPReservationListWithDefaults instantiates a new IPReservationList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPReservationListWithDefaults() *IPReservationList { + this := IPReservationList{} + return &this +} + +// GetIpAddresses returns the IpAddresses field value if set, zero value otherwise. +func (o *IPReservationList) GetIpAddresses() []IPReservationListIpAddressesInner { + if o == nil || IsNil(o.IpAddresses) { + var ret []IPReservationListIpAddressesInner + return ret + } + return o.IpAddresses +} + +// GetIpAddressesOk returns a tuple with the IpAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationList) GetIpAddressesOk() ([]IPReservationListIpAddressesInner, bool) { + if o == nil || IsNil(o.IpAddresses) { + return nil, false + } + return o.IpAddresses, true +} + +// HasIpAddresses returns a boolean if a field has been set. +func (o *IPReservationList) HasIpAddresses() bool { + if o != nil && !IsNil(o.IpAddresses) { + return true + } + + return false +} + +// SetIpAddresses gets a reference to the given []IPReservationListIpAddressesInner and assigns it to the IpAddresses field. +func (o *IPReservationList) SetIpAddresses(v []IPReservationListIpAddressesInner) { + o.IpAddresses = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *IPReservationList) GetMeta() Meta { + if o == nil || IsNil(o.Meta) { + var ret Meta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationList) GetMetaOk() (*Meta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *IPReservationList) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given Meta and assigns it to the Meta field. +func (o *IPReservationList) SetMeta(v Meta) { + o.Meta = &v +} + +func (o IPReservationList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPReservationList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.IpAddresses) { + toSerialize["ip_addresses"] = o.IpAddresses + } + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IPReservationList) UnmarshalJSON(data []byte) (err error) { + varIPReservationList := _IPReservationList{} + + err = json.Unmarshal(data, &varIPReservationList) + + if err != nil { + return err + } + + *o = IPReservationList(varIPReservationList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ip_addresses") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIPReservationList struct { + value *IPReservationList + isSet bool +} + +func (v NullableIPReservationList) Get() *IPReservationList { + return v.value +} + +func (v *NullableIPReservationList) Set(val *IPReservationList) { + v.value = val + v.isSet = true +} + +func (v NullableIPReservationList) IsSet() bool { + return v.isSet +} + +func (v *NullableIPReservationList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPReservationList(val *IPReservationList) *NullableIPReservationList { + return &NullableIPReservationList{value: val, isSet: true} +} + +func (v NullableIPReservationList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPReservationList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_list_ip_addresses_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_list_ip_addresses_inner.go new file mode 100644 index 00000000..bb6966c3 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_list_ip_addresses_inner.go @@ -0,0 +1,104 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// IPReservationListIpAddressesInner struct for IPReservationListIpAddressesInner +type IPReservationListIpAddressesInner struct { + IPReservation *IPReservation + VrfIpReservation *VrfIpReservation +} + +// Unmarshal JSON data into any of the pointers in the struct +func (dst *IPReservationListIpAddressesInner) UnmarshalJSON(data []byte) error { + var err error + // try to unmarshal JSON data into IPReservation + err = json.Unmarshal(data, &dst.IPReservation) + if err == nil { + jsonIPReservation, _ := json.Marshal(dst.IPReservation) + if string(jsonIPReservation) == "{}" { // empty struct + dst.IPReservation = nil + } else { + return nil // data stored in dst.IPReservation, return on the first match + } + } else { + dst.IPReservation = nil + } + + // try to unmarshal JSON data into VrfIpReservation + err = json.Unmarshal(data, &dst.VrfIpReservation) + if err == nil { + jsonVrfIpReservation, _ := json.Marshal(dst.VrfIpReservation) + if string(jsonVrfIpReservation) == "{}" { // empty struct + dst.VrfIpReservation = nil + } else { + return nil // data stored in dst.VrfIpReservation, return on the first match + } + } else { + dst.VrfIpReservation = nil + } + + return fmt.Errorf("data failed to match schemas in anyOf(IPReservationListIpAddressesInner)") +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src *IPReservationListIpAddressesInner) MarshalJSON() ([]byte, error) { + if src.IPReservation != nil { + return json.Marshal(&src.IPReservation) + } + + if src.VrfIpReservation != nil { + return json.Marshal(&src.VrfIpReservation) + } + + return nil, nil // no data in anyOf schemas +} + +type NullableIPReservationListIpAddressesInner struct { + value *IPReservationListIpAddressesInner + isSet bool +} + +func (v NullableIPReservationListIpAddressesInner) Get() *IPReservationListIpAddressesInner { + return v.value +} + +func (v *NullableIPReservationListIpAddressesInner) Set(val *IPReservationListIpAddressesInner) { + v.value = val + v.isSet = true +} + +func (v NullableIPReservationListIpAddressesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableIPReservationListIpAddressesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPReservationListIpAddressesInner(val *IPReservationListIpAddressesInner) *NullableIPReservationListIpAddressesInner { + return &NullableIPReservationListIpAddressesInner{value: val, isSet: true} +} + +func (v NullableIPReservationListIpAddressesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPReservationListIpAddressesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_metro.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_metro.go new file mode 100644 index 00000000..0991eca3 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_metro.go @@ -0,0 +1,265 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the IPReservationMetro type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPReservationMetro{} + +// IPReservationMetro struct for IPReservationMetro +type IPReservationMetro struct { + Code *string `json:"code,omitempty"` + Country *string `json:"country,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IPReservationMetro IPReservationMetro + +// NewIPReservationMetro instantiates a new IPReservationMetro object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPReservationMetro() *IPReservationMetro { + this := IPReservationMetro{} + return &this +} + +// NewIPReservationMetroWithDefaults instantiates a new IPReservationMetro object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPReservationMetroWithDefaults() *IPReservationMetro { + this := IPReservationMetro{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *IPReservationMetro) GetCode() string { + if o == nil || IsNil(o.Code) { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationMetro) GetCodeOk() (*string, bool) { + if o == nil || IsNil(o.Code) { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *IPReservationMetro) HasCode() bool { + if o != nil && !IsNil(o.Code) { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *IPReservationMetro) SetCode(v string) { + o.Code = &v +} + +// GetCountry returns the Country field value if set, zero value otherwise. +func (o *IPReservationMetro) GetCountry() string { + if o == nil || IsNil(o.Country) { + var ret string + return ret + } + return *o.Country +} + +// GetCountryOk returns a tuple with the Country field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationMetro) GetCountryOk() (*string, bool) { + if o == nil || IsNil(o.Country) { + return nil, false + } + return o.Country, true +} + +// HasCountry returns a boolean if a field has been set. +func (o *IPReservationMetro) HasCountry() bool { + if o != nil && !IsNil(o.Country) { + return true + } + + return false +} + +// SetCountry gets a reference to the given string and assigns it to the Country field. +func (o *IPReservationMetro) SetCountry(v string) { + o.Country = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *IPReservationMetro) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationMetro) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *IPReservationMetro) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *IPReservationMetro) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *IPReservationMetro) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationMetro) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *IPReservationMetro) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *IPReservationMetro) SetName(v string) { + o.Name = &v +} + +func (o IPReservationMetro) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPReservationMetro) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Code) { + toSerialize["code"] = o.Code + } + if !IsNil(o.Country) { + toSerialize["country"] = o.Country + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IPReservationMetro) UnmarshalJSON(data []byte) (err error) { + varIPReservationMetro := _IPReservationMetro{} + + err = json.Unmarshal(data, &varIPReservationMetro) + + if err != nil { + return err + } + + *o = IPReservationMetro(varIPReservationMetro) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "country") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIPReservationMetro struct { + value *IPReservationMetro + isSet bool +} + +func (v NullableIPReservationMetro) Get() *IPReservationMetro { + return v.value +} + +func (v *NullableIPReservationMetro) Set(val *IPReservationMetro) { + v.value = val + v.isSet = true +} + +func (v NullableIPReservationMetro) IsSet() bool { + return v.isSet +} + +func (v *NullableIPReservationMetro) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPReservationMetro(val *IPReservationMetro) *NullableIPReservationMetro { + return &NullableIPReservationMetro{value: val, isSet: true} +} + +func (v NullableIPReservationMetro) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPReservationMetro) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_request_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_request_input.go new file mode 100644 index 00000000..8992d6c9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_request_input.go @@ -0,0 +1,456 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the IPReservationRequestInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPReservationRequestInput{} + +// IPReservationRequestInput struct for IPReservationRequestInput +type IPReservationRequestInput struct { + Comments *string `json:"comments,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Details *string `json:"details,omitempty"` + Facility *string `json:"facility,omitempty"` + FailOnApprovalRequired *bool `json:"fail_on_approval_required,omitempty"` + // The code of the metro you are requesting the IP reservation in. + Metro *string `json:"metro,omitempty"` + Quantity int32 `json:"quantity"` + Tags []string `json:"tags,omitempty"` + Type string `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _IPReservationRequestInput IPReservationRequestInput + +// NewIPReservationRequestInput instantiates a new IPReservationRequestInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIPReservationRequestInput(quantity int32, type_ string) *IPReservationRequestInput { + this := IPReservationRequestInput{} + this.Quantity = quantity + this.Type = type_ + return &this +} + +// NewIPReservationRequestInputWithDefaults instantiates a new IPReservationRequestInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIPReservationRequestInputWithDefaults() *IPReservationRequestInput { + this := IPReservationRequestInput{} + return &this +} + +// GetComments returns the Comments field value if set, zero value otherwise. +func (o *IPReservationRequestInput) GetComments() string { + if o == nil || IsNil(o.Comments) { + var ret string + return ret + } + return *o.Comments +} + +// GetCommentsOk returns a tuple with the Comments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationRequestInput) GetCommentsOk() (*string, bool) { + if o == nil || IsNil(o.Comments) { + return nil, false + } + return o.Comments, true +} + +// HasComments returns a boolean if a field has been set. +func (o *IPReservationRequestInput) HasComments() bool { + if o != nil && !IsNil(o.Comments) { + return true + } + + return false +} + +// SetComments gets a reference to the given string and assigns it to the Comments field. +func (o *IPReservationRequestInput) SetComments(v string) { + o.Comments = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *IPReservationRequestInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationRequestInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *IPReservationRequestInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *IPReservationRequestInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *IPReservationRequestInput) GetDetails() string { + if o == nil || IsNil(o.Details) { + var ret string + return ret + } + return *o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationRequestInput) GetDetailsOk() (*string, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *IPReservationRequestInput) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *IPReservationRequestInput) SetDetails(v string) { + o.Details = &v +} + +// GetFacility returns the Facility field value if set, zero value otherwise. +func (o *IPReservationRequestInput) GetFacility() string { + if o == nil || IsNil(o.Facility) { + var ret string + return ret + } + return *o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationRequestInput) GetFacilityOk() (*string, bool) { + if o == nil || IsNil(o.Facility) { + return nil, false + } + return o.Facility, true +} + +// HasFacility returns a boolean if a field has been set. +func (o *IPReservationRequestInput) HasFacility() bool { + if o != nil && !IsNil(o.Facility) { + return true + } + + return false +} + +// SetFacility gets a reference to the given string and assigns it to the Facility field. +func (o *IPReservationRequestInput) SetFacility(v string) { + o.Facility = &v +} + +// GetFailOnApprovalRequired returns the FailOnApprovalRequired field value if set, zero value otherwise. +func (o *IPReservationRequestInput) GetFailOnApprovalRequired() bool { + if o == nil || IsNil(o.FailOnApprovalRequired) { + var ret bool + return ret + } + return *o.FailOnApprovalRequired +} + +// GetFailOnApprovalRequiredOk returns a tuple with the FailOnApprovalRequired field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationRequestInput) GetFailOnApprovalRequiredOk() (*bool, bool) { + if o == nil || IsNil(o.FailOnApprovalRequired) { + return nil, false + } + return o.FailOnApprovalRequired, true +} + +// HasFailOnApprovalRequired returns a boolean if a field has been set. +func (o *IPReservationRequestInput) HasFailOnApprovalRequired() bool { + if o != nil && !IsNil(o.FailOnApprovalRequired) { + return true + } + + return false +} + +// SetFailOnApprovalRequired gets a reference to the given bool and assigns it to the FailOnApprovalRequired field. +func (o *IPReservationRequestInput) SetFailOnApprovalRequired(v bool) { + o.FailOnApprovalRequired = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *IPReservationRequestInput) GetMetro() string { + if o == nil || IsNil(o.Metro) { + var ret string + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationRequestInput) GetMetroOk() (*string, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *IPReservationRequestInput) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given string and assigns it to the Metro field. +func (o *IPReservationRequestInput) SetMetro(v string) { + o.Metro = &v +} + +// GetQuantity returns the Quantity field value +func (o *IPReservationRequestInput) GetQuantity() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value +// and a boolean to check if the value has been set. +func (o *IPReservationRequestInput) GetQuantityOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Quantity, true +} + +// SetQuantity sets field value +func (o *IPReservationRequestInput) SetQuantity(v int32) { + o.Quantity = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *IPReservationRequestInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IPReservationRequestInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *IPReservationRequestInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *IPReservationRequestInput) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value +func (o *IPReservationRequestInput) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IPReservationRequestInput) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *IPReservationRequestInput) SetType(v string) { + o.Type = v +} + +func (o IPReservationRequestInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPReservationRequestInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Comments) { + toSerialize["comments"] = o.Comments + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + if !IsNil(o.Facility) { + toSerialize["facility"] = o.Facility + } + if !IsNil(o.FailOnApprovalRequired) { + toSerialize["fail_on_approval_required"] = o.FailOnApprovalRequired + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + toSerialize["quantity"] = o.Quantity + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IPReservationRequestInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "quantity", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIPReservationRequestInput := _IPReservationRequestInput{} + + err = json.Unmarshal(data, &varIPReservationRequestInput) + + if err != nil { + return err + } + + *o = IPReservationRequestInput(varIPReservationRequestInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "comments") + delete(additionalProperties, "customdata") + delete(additionalProperties, "details") + delete(additionalProperties, "facility") + delete(additionalProperties, "fail_on_approval_required") + delete(additionalProperties, "metro") + delete(additionalProperties, "quantity") + delete(additionalProperties, "tags") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIPReservationRequestInput struct { + value *IPReservationRequestInput + isSet bool +} + +func (v NullableIPReservationRequestInput) Get() *IPReservationRequestInput { + return v.value +} + +func (v *NullableIPReservationRequestInput) Set(val *IPReservationRequestInput) { + v.value = val + v.isSet = true +} + +func (v NullableIPReservationRequestInput) IsSet() bool { + return v.isSet +} + +func (v *NullableIPReservationRequestInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPReservationRequestInput(val *IPReservationRequestInput) *NullableIPReservationRequestInput { + return &NullableIPReservationRequestInput{value: val, isSet: true} +} + +func (v NullableIPReservationRequestInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPReservationRequestInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_type.go new file mode 100644 index 00000000..9d1a1fe6 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ip_reservation_type.go @@ -0,0 +1,115 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// IPReservationType the model 'IPReservationType' +type IPReservationType string + +// List of IPReservation_type +const ( + IPRESERVATIONTYPE_GLOBAL_IPV4 IPReservationType = "global_ipv4" + IPRESERVATIONTYPE_PUBLIC_IPV4 IPReservationType = "public_ipv4" + IPRESERVATIONTYPE_PRIVATE_IPV4 IPReservationType = "private_ipv4" + IPRESERVATIONTYPE_PUBLIC_IPV6 IPReservationType = "public_ipv6" +) + +// All allowed values of IPReservationType enum +var AllowedIPReservationTypeEnumValues = []IPReservationType{ + "global_ipv4", + "public_ipv4", + "private_ipv4", + "public_ipv6", +} + +func (v *IPReservationType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := IPReservationType(value) + for _, existing := range AllowedIPReservationTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid IPReservationType", value) +} + +// NewIPReservationTypeFromValue returns a pointer to a valid IPReservationType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewIPReservationTypeFromValue(v string) (*IPReservationType, error) { + ev := IPReservationType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for IPReservationType: valid values are %v", v, AllowedIPReservationTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v IPReservationType) IsValid() bool { + for _, existing := range AllowedIPReservationTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IPReservation_type value +func (v IPReservationType) Ptr() *IPReservationType { + return &v +} + +type NullableIPReservationType struct { + value *IPReservationType + isSet bool +} + +func (v NullableIPReservationType) Get() *IPReservationType { + return v.value +} + +func (v *NullableIPReservationType) Set(val *IPReservationType) { + v.value = val + v.isSet = true +} + +func (v NullableIPReservationType) IsSet() bool { + return v.isSet +} + +func (v *NullableIPReservationType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPReservationType(val *IPReservationType) *NullableIPReservationType { + return &NullableIPReservationType{value: val, isSet: true} +} + +func (v NullableIPReservationType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPReservationType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license.go new file mode 100644 index 00000000..b54eaff5 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license.go @@ -0,0 +1,339 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the License type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &License{} + +// License struct for License +type License struct { + Description *string `json:"description,omitempty"` + Id *string `json:"id,omitempty"` + LicenseKey *string `json:"license_key,omitempty"` + LicenseeProduct *Href `json:"licensee_product,omitempty"` + Project *Href `json:"project,omitempty"` + Size *float32 `json:"size,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _License License + +// NewLicense instantiates a new License object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewLicense() *License { + this := License{} + return &this +} + +// NewLicenseWithDefaults instantiates a new License object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewLicenseWithDefaults() *License { + this := License{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *License) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *License) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *License) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *License) SetDescription(v string) { + o.Description = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *License) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *License) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *License) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *License) SetId(v string) { + o.Id = &v +} + +// GetLicenseKey returns the LicenseKey field value if set, zero value otherwise. +func (o *License) GetLicenseKey() string { + if o == nil || IsNil(o.LicenseKey) { + var ret string + return ret + } + return *o.LicenseKey +} + +// GetLicenseKeyOk returns a tuple with the LicenseKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *License) GetLicenseKeyOk() (*string, bool) { + if o == nil || IsNil(o.LicenseKey) { + return nil, false + } + return o.LicenseKey, true +} + +// HasLicenseKey returns a boolean if a field has been set. +func (o *License) HasLicenseKey() bool { + if o != nil && !IsNil(o.LicenseKey) { + return true + } + + return false +} + +// SetLicenseKey gets a reference to the given string and assigns it to the LicenseKey field. +func (o *License) SetLicenseKey(v string) { + o.LicenseKey = &v +} + +// GetLicenseeProduct returns the LicenseeProduct field value if set, zero value otherwise. +func (o *License) GetLicenseeProduct() Href { + if o == nil || IsNil(o.LicenseeProduct) { + var ret Href + return ret + } + return *o.LicenseeProduct +} + +// GetLicenseeProductOk returns a tuple with the LicenseeProduct field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *License) GetLicenseeProductOk() (*Href, bool) { + if o == nil || IsNil(o.LicenseeProduct) { + return nil, false + } + return o.LicenseeProduct, true +} + +// HasLicenseeProduct returns a boolean if a field has been set. +func (o *License) HasLicenseeProduct() bool { + if o != nil && !IsNil(o.LicenseeProduct) { + return true + } + + return false +} + +// SetLicenseeProduct gets a reference to the given Href and assigns it to the LicenseeProduct field. +func (o *License) SetLicenseeProduct(v Href) { + o.LicenseeProduct = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *License) GetProject() Href { + if o == nil || IsNil(o.Project) { + var ret Href + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *License) GetProjectOk() (*Href, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *License) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Href and assigns it to the Project field. +func (o *License) SetProject(v Href) { + o.Project = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *License) GetSize() float32 { + if o == nil || IsNil(o.Size) { + var ret float32 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *License) GetSizeOk() (*float32, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *License) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given float32 and assigns it to the Size field. +func (o *License) SetSize(v float32) { + o.Size = &v +} + +func (o License) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o License) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.LicenseKey) { + toSerialize["license_key"] = o.LicenseKey + } + if !IsNil(o.LicenseeProduct) { + toSerialize["licensee_product"] = o.LicenseeProduct + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *License) UnmarshalJSON(data []byte) (err error) { + varLicense := _License{} + + err = json.Unmarshal(data, &varLicense) + + if err != nil { + return err + } + + *o = License(varLicense) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "license_key") + delete(additionalProperties, "licensee_product") + delete(additionalProperties, "project") + delete(additionalProperties, "size") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableLicense struct { + value *License + isSet bool +} + +func (v NullableLicense) Get() *License { + return v.value +} + +func (v *NullableLicense) Set(val *License) { + v.value = val + v.isSet = true +} + +func (v NullableLicense) IsSet() bool { + return v.isSet +} + +func (v *NullableLicense) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLicense(val *License) *NullableLicense { + return &NullableLicense{value: val, isSet: true} +} + +func (v NullableLicense) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLicense) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_create_input.go new file mode 100644 index 00000000..78efb01e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_create_input.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the LicenseCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LicenseCreateInput{} + +// LicenseCreateInput struct for LicenseCreateInput +type LicenseCreateInput struct { + Description *string `json:"description,omitempty"` + LicenseeProductId *string `json:"licensee_product_id,omitempty"` + Size *float32 `json:"size,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _LicenseCreateInput LicenseCreateInput + +// NewLicenseCreateInput instantiates a new LicenseCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewLicenseCreateInput() *LicenseCreateInput { + this := LicenseCreateInput{} + return &this +} + +// NewLicenseCreateInputWithDefaults instantiates a new LicenseCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewLicenseCreateInputWithDefaults() *LicenseCreateInput { + this := LicenseCreateInput{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *LicenseCreateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LicenseCreateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *LicenseCreateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *LicenseCreateInput) SetDescription(v string) { + o.Description = &v +} + +// GetLicenseeProductId returns the LicenseeProductId field value if set, zero value otherwise. +func (o *LicenseCreateInput) GetLicenseeProductId() string { + if o == nil || IsNil(o.LicenseeProductId) { + var ret string + return ret + } + return *o.LicenseeProductId +} + +// GetLicenseeProductIdOk returns a tuple with the LicenseeProductId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LicenseCreateInput) GetLicenseeProductIdOk() (*string, bool) { + if o == nil || IsNil(o.LicenseeProductId) { + return nil, false + } + return o.LicenseeProductId, true +} + +// HasLicenseeProductId returns a boolean if a field has been set. +func (o *LicenseCreateInput) HasLicenseeProductId() bool { + if o != nil && !IsNil(o.LicenseeProductId) { + return true + } + + return false +} + +// SetLicenseeProductId gets a reference to the given string and assigns it to the LicenseeProductId field. +func (o *LicenseCreateInput) SetLicenseeProductId(v string) { + o.LicenseeProductId = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *LicenseCreateInput) GetSize() float32 { + if o == nil || IsNil(o.Size) { + var ret float32 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LicenseCreateInput) GetSizeOk() (*float32, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *LicenseCreateInput) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given float32 and assigns it to the Size field. +func (o *LicenseCreateInput) SetSize(v float32) { + o.Size = &v +} + +func (o LicenseCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LicenseCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.LicenseeProductId) { + toSerialize["licensee_product_id"] = o.LicenseeProductId + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *LicenseCreateInput) UnmarshalJSON(data []byte) (err error) { + varLicenseCreateInput := _LicenseCreateInput{} + + err = json.Unmarshal(data, &varLicenseCreateInput) + + if err != nil { + return err + } + + *o = LicenseCreateInput(varLicenseCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "licensee_product_id") + delete(additionalProperties, "size") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableLicenseCreateInput struct { + value *LicenseCreateInput + isSet bool +} + +func (v NullableLicenseCreateInput) Get() *LicenseCreateInput { + return v.value +} + +func (v *NullableLicenseCreateInput) Set(val *LicenseCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableLicenseCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableLicenseCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLicenseCreateInput(val *LicenseCreateInput) *NullableLicenseCreateInput { + return &NullableLicenseCreateInput{value: val, isSet: true} +} + +func (v NullableLicenseCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLicenseCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_list.go new file mode 100644 index 00000000..5ccede3b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the LicenseList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LicenseList{} + +// LicenseList struct for LicenseList +type LicenseList struct { + Licenses []License `json:"licenses,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _LicenseList LicenseList + +// NewLicenseList instantiates a new LicenseList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewLicenseList() *LicenseList { + this := LicenseList{} + return &this +} + +// NewLicenseListWithDefaults instantiates a new LicenseList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewLicenseListWithDefaults() *LicenseList { + this := LicenseList{} + return &this +} + +// GetLicenses returns the Licenses field value if set, zero value otherwise. +func (o *LicenseList) GetLicenses() []License { + if o == nil || IsNil(o.Licenses) { + var ret []License + return ret + } + return o.Licenses +} + +// GetLicensesOk returns a tuple with the Licenses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LicenseList) GetLicensesOk() ([]License, bool) { + if o == nil || IsNil(o.Licenses) { + return nil, false + } + return o.Licenses, true +} + +// HasLicenses returns a boolean if a field has been set. +func (o *LicenseList) HasLicenses() bool { + if o != nil && !IsNil(o.Licenses) { + return true + } + + return false +} + +// SetLicenses gets a reference to the given []License and assigns it to the Licenses field. +func (o *LicenseList) SetLicenses(v []License) { + o.Licenses = v +} + +func (o LicenseList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LicenseList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Licenses) { + toSerialize["licenses"] = o.Licenses + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *LicenseList) UnmarshalJSON(data []byte) (err error) { + varLicenseList := _LicenseList{} + + err = json.Unmarshal(data, &varLicenseList) + + if err != nil { + return err + } + + *o = LicenseList(varLicenseList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "licenses") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableLicenseList struct { + value *LicenseList + isSet bool +} + +func (v NullableLicenseList) Get() *LicenseList { + return v.value +} + +func (v *NullableLicenseList) Set(val *LicenseList) { + v.value = val + v.isSet = true +} + +func (v NullableLicenseList) IsSet() bool { + return v.isSet +} + +func (v *NullableLicenseList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLicenseList(val *LicenseList) *NullableLicenseList { + return &NullableLicenseList{value: val, isSet: true} +} + +func (v NullableLicenseList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLicenseList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_update_input.go new file mode 100644 index 00000000..a5e0d25c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_license_update_input.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the LicenseUpdateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LicenseUpdateInput{} + +// LicenseUpdateInput struct for LicenseUpdateInput +type LicenseUpdateInput struct { + Description *string `json:"description,omitempty"` + Size *float32 `json:"size,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _LicenseUpdateInput LicenseUpdateInput + +// NewLicenseUpdateInput instantiates a new LicenseUpdateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewLicenseUpdateInput() *LicenseUpdateInput { + this := LicenseUpdateInput{} + return &this +} + +// NewLicenseUpdateInputWithDefaults instantiates a new LicenseUpdateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewLicenseUpdateInputWithDefaults() *LicenseUpdateInput { + this := LicenseUpdateInput{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *LicenseUpdateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LicenseUpdateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *LicenseUpdateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *LicenseUpdateInput) SetDescription(v string) { + o.Description = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *LicenseUpdateInput) GetSize() float32 { + if o == nil || IsNil(o.Size) { + var ret float32 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LicenseUpdateInput) GetSizeOk() (*float32, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *LicenseUpdateInput) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given float32 and assigns it to the Size field. +func (o *LicenseUpdateInput) SetSize(v float32) { + o.Size = &v +} + +func (o LicenseUpdateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LicenseUpdateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *LicenseUpdateInput) UnmarshalJSON(data []byte) (err error) { + varLicenseUpdateInput := _LicenseUpdateInput{} + + err = json.Unmarshal(data, &varLicenseUpdateInput) + + if err != nil { + return err + } + + *o = LicenseUpdateInput(varLicenseUpdateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "size") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableLicenseUpdateInput struct { + value *LicenseUpdateInput + isSet bool +} + +func (v NullableLicenseUpdateInput) Get() *LicenseUpdateInput { + return v.value +} + +func (v *NullableLicenseUpdateInput) Set(val *LicenseUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullableLicenseUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableLicenseUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLicenseUpdateInput(val *LicenseUpdateInput) *NullableLicenseUpdateInput { + return &NullableLicenseUpdateInput{value: val, isSet: true} +} + +func (v NullableLicenseUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLicenseUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_line_item.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_line_item.go new file mode 100644 index 00000000..a9a6c144 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_line_item.go @@ -0,0 +1,376 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the LineItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LineItem{} + +// LineItem struct for LineItem +type LineItem struct { + Amount *float32 `json:"amount,omitempty"` + Currency *string `json:"currency,omitempty"` + Description *string `json:"description,omitempty"` + Details *string `json:"details,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Unit *string `json:"unit,omitempty"` + UnitPrice *float32 `json:"unit_price,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _LineItem LineItem + +// NewLineItem instantiates a new LineItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewLineItem() *LineItem { + this := LineItem{} + return &this +} + +// NewLineItemWithDefaults instantiates a new LineItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewLineItemWithDefaults() *LineItem { + this := LineItem{} + return &this +} + +// GetAmount returns the Amount field value if set, zero value otherwise. +func (o *LineItem) GetAmount() float32 { + if o == nil || IsNil(o.Amount) { + var ret float32 + return ret + } + return *o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LineItem) GetAmountOk() (*float32, bool) { + if o == nil || IsNil(o.Amount) { + return nil, false + } + return o.Amount, true +} + +// HasAmount returns a boolean if a field has been set. +func (o *LineItem) HasAmount() bool { + if o != nil && !IsNil(o.Amount) { + return true + } + + return false +} + +// SetAmount gets a reference to the given float32 and assigns it to the Amount field. +func (o *LineItem) SetAmount(v float32) { + o.Amount = &v +} + +// GetCurrency returns the Currency field value if set, zero value otherwise. +func (o *LineItem) GetCurrency() string { + if o == nil || IsNil(o.Currency) { + var ret string + return ret + } + return *o.Currency +} + +// GetCurrencyOk returns a tuple with the Currency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LineItem) GetCurrencyOk() (*string, bool) { + if o == nil || IsNil(o.Currency) { + return nil, false + } + return o.Currency, true +} + +// HasCurrency returns a boolean if a field has been set. +func (o *LineItem) HasCurrency() bool { + if o != nil && !IsNil(o.Currency) { + return true + } + + return false +} + +// SetCurrency gets a reference to the given string and assigns it to the Currency field. +func (o *LineItem) SetCurrency(v string) { + o.Currency = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *LineItem) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LineItem) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *LineItem) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *LineItem) SetDescription(v string) { + o.Description = &v +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *LineItem) GetDetails() string { + if o == nil || IsNil(o.Details) { + var ret string + return ret + } + return *o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LineItem) GetDetailsOk() (*string, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *LineItem) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *LineItem) SetDetails(v string) { + o.Details = &v +} + +// GetPlan returns the Plan field value if set, zero value otherwise. +func (o *LineItem) GetPlan() Plan { + if o == nil || IsNil(o.Plan) { + var ret Plan + return ret + } + return *o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LineItem) GetPlanOk() (*Plan, bool) { + if o == nil || IsNil(o.Plan) { + return nil, false + } + return o.Plan, true +} + +// HasPlan returns a boolean if a field has been set. +func (o *LineItem) HasPlan() bool { + if o != nil && !IsNil(o.Plan) { + return true + } + + return false +} + +// SetPlan gets a reference to the given Plan and assigns it to the Plan field. +func (o *LineItem) SetPlan(v Plan) { + o.Plan = &v +} + +// GetUnit returns the Unit field value if set, zero value otherwise. +func (o *LineItem) GetUnit() string { + if o == nil || IsNil(o.Unit) { + var ret string + return ret + } + return *o.Unit +} + +// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LineItem) GetUnitOk() (*string, bool) { + if o == nil || IsNil(o.Unit) { + return nil, false + } + return o.Unit, true +} + +// HasUnit returns a boolean if a field has been set. +func (o *LineItem) HasUnit() bool { + if o != nil && !IsNil(o.Unit) { + return true + } + + return false +} + +// SetUnit gets a reference to the given string and assigns it to the Unit field. +func (o *LineItem) SetUnit(v string) { + o.Unit = &v +} + +// GetUnitPrice returns the UnitPrice field value if set, zero value otherwise. +func (o *LineItem) GetUnitPrice() float32 { + if o == nil || IsNil(o.UnitPrice) { + var ret float32 + return ret + } + return *o.UnitPrice +} + +// GetUnitPriceOk returns a tuple with the UnitPrice field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LineItem) GetUnitPriceOk() (*float32, bool) { + if o == nil || IsNil(o.UnitPrice) { + return nil, false + } + return o.UnitPrice, true +} + +// HasUnitPrice returns a boolean if a field has been set. +func (o *LineItem) HasUnitPrice() bool { + if o != nil && !IsNil(o.UnitPrice) { + return true + } + + return false +} + +// SetUnitPrice gets a reference to the given float32 and assigns it to the UnitPrice field. +func (o *LineItem) SetUnitPrice(v float32) { + o.UnitPrice = &v +} + +func (o LineItem) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LineItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Amount) { + toSerialize["amount"] = o.Amount + } + if !IsNil(o.Currency) { + toSerialize["currency"] = o.Currency + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + if !IsNil(o.Plan) { + toSerialize["plan"] = o.Plan + } + if !IsNil(o.Unit) { + toSerialize["unit"] = o.Unit + } + if !IsNil(o.UnitPrice) { + toSerialize["unit_price"] = o.UnitPrice + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *LineItem) UnmarshalJSON(data []byte) (err error) { + varLineItem := _LineItem{} + + err = json.Unmarshal(data, &varLineItem) + + if err != nil { + return err + } + + *o = LineItem(varLineItem) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "amount") + delete(additionalProperties, "currency") + delete(additionalProperties, "description") + delete(additionalProperties, "details") + delete(additionalProperties, "plan") + delete(additionalProperties, "unit") + delete(additionalProperties, "unit_price") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableLineItem struct { + value *LineItem + isSet bool +} + +func (v NullableLineItem) Get() *LineItem { + return v.value +} + +func (v *NullableLineItem) Set(val *LineItem) { + v.value = val + v.isSet = true +} + +func (v NullableLineItem) IsSet() bool { + return v.isSet +} + +func (v *NullableLineItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLineItem(val *LineItem) *NullableLineItem { + return &NullableLineItem{value: val, isSet: true} +} + +func (v NullableLineItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLineItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership.go new file mode 100644 index 00000000..256e9a8d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership.go @@ -0,0 +1,377 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the Membership type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Membership{} + +// Membership struct for Membership +type Membership struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Project *Href `json:"project,omitempty"` + Roles []string `json:"roles,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + User *Href `json:"user,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Membership Membership + +// NewMembership instantiates a new Membership object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMembership() *Membership { + this := Membership{} + return &this +} + +// NewMembershipWithDefaults instantiates a new Membership object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMembershipWithDefaults() *Membership { + this := Membership{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Membership) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Membership) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Membership) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Membership) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Membership) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Membership) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *Membership) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Membership) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Membership) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Membership) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Membership) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Membership) SetId(v string) { + o.Id = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *Membership) GetProject() Href { + if o == nil || IsNil(o.Project) { + var ret Href + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Membership) GetProjectOk() (*Href, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *Membership) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Href and assigns it to the Project field. +func (o *Membership) SetProject(v Href) { + o.Project = &v +} + +// GetRoles returns the Roles field value if set, zero value otherwise. +func (o *Membership) GetRoles() []string { + if o == nil || IsNil(o.Roles) { + var ret []string + return ret + } + return o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Membership) GetRolesOk() ([]string, bool) { + if o == nil || IsNil(o.Roles) { + return nil, false + } + return o.Roles, true +} + +// HasRoles returns a boolean if a field has been set. +func (o *Membership) HasRoles() bool { + if o != nil && !IsNil(o.Roles) { + return true + } + + return false +} + +// SetRoles gets a reference to the given []string and assigns it to the Roles field. +func (o *Membership) SetRoles(v []string) { + o.Roles = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Membership) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Membership) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Membership) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Membership) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetUser returns the User field value if set, zero value otherwise. +func (o *Membership) GetUser() Href { + if o == nil || IsNil(o.User) { + var ret Href + return ret + } + return *o.User +} + +// GetUserOk returns a tuple with the User field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Membership) GetUserOk() (*Href, bool) { + if o == nil || IsNil(o.User) { + return nil, false + } + return o.User, true +} + +// HasUser returns a boolean if a field has been set. +func (o *Membership) HasUser() bool { + if o != nil && !IsNil(o.User) { + return true + } + + return false +} + +// SetUser gets a reference to the given Href and assigns it to the User field. +func (o *Membership) SetUser(v Href) { + o.User = &v +} + +func (o Membership) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Membership) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.Roles) { + toSerialize["roles"] = o.Roles + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.User) { + toSerialize["user"] = o.User + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Membership) UnmarshalJSON(data []byte) (err error) { + varMembership := _Membership{} + + err = json.Unmarshal(data, &varMembership) + + if err != nil { + return err + } + + *o = Membership(varMembership) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "project") + delete(additionalProperties, "roles") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "user") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMembership struct { + value *Membership + isSet bool +} + +func (v NullableMembership) Get() *Membership { + return v.value +} + +func (v *NullableMembership) Set(val *Membership) { + v.value = val + v.isSet = true +} + +func (v NullableMembership) IsSet() bool { + return v.isSet +} + +func (v *NullableMembership) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMembership(val *Membership) *NullableMembership { + return &NullableMembership{value: val, isSet: true} +} + +func (v NullableMembership) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMembership) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership_input.go new file mode 100644 index 00000000..09a0c2dc --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership_input.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the MembershipInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MembershipInput{} + +// MembershipInput struct for MembershipInput +type MembershipInput struct { + Role []string `json:"role,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MembershipInput MembershipInput + +// NewMembershipInput instantiates a new MembershipInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMembershipInput() *MembershipInput { + this := MembershipInput{} + return &this +} + +// NewMembershipInputWithDefaults instantiates a new MembershipInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMembershipInputWithDefaults() *MembershipInput { + this := MembershipInput{} + return &this +} + +// GetRole returns the Role field value if set, zero value otherwise. +func (o *MembershipInput) GetRole() []string { + if o == nil || IsNil(o.Role) { + var ret []string + return ret + } + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MembershipInput) GetRoleOk() ([]string, bool) { + if o == nil || IsNil(o.Role) { + return nil, false + } + return o.Role, true +} + +// HasRole returns a boolean if a field has been set. +func (o *MembershipInput) HasRole() bool { + if o != nil && !IsNil(o.Role) { + return true + } + + return false +} + +// SetRole gets a reference to the given []string and assigns it to the Role field. +func (o *MembershipInput) SetRole(v []string) { + o.Role = v +} + +func (o MembershipInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MembershipInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Role) { + toSerialize["role"] = o.Role + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MembershipInput) UnmarshalJSON(data []byte) (err error) { + varMembershipInput := _MembershipInput{} + + err = json.Unmarshal(data, &varMembershipInput) + + if err != nil { + return err + } + + *o = MembershipInput(varMembershipInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "role") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMembershipInput struct { + value *MembershipInput + isSet bool +} + +func (v NullableMembershipInput) Get() *MembershipInput { + return v.value +} + +func (v *NullableMembershipInput) Set(val *MembershipInput) { + v.value = val + v.isSet = true +} + +func (v NullableMembershipInput) IsSet() bool { + return v.isSet +} + +func (v *NullableMembershipInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMembershipInput(val *MembershipInput) *NullableMembershipInput { + return &NullableMembershipInput{value: val, isSet: true} +} + +func (v NullableMembershipInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMembershipInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership_list.go new file mode 100644 index 00000000..88ba7613 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_membership_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the MembershipList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MembershipList{} + +// MembershipList struct for MembershipList +type MembershipList struct { + Memberships []Membership `json:"memberships,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MembershipList MembershipList + +// NewMembershipList instantiates a new MembershipList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMembershipList() *MembershipList { + this := MembershipList{} + return &this +} + +// NewMembershipListWithDefaults instantiates a new MembershipList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMembershipListWithDefaults() *MembershipList { + this := MembershipList{} + return &this +} + +// GetMemberships returns the Memberships field value if set, zero value otherwise. +func (o *MembershipList) GetMemberships() []Membership { + if o == nil || IsNil(o.Memberships) { + var ret []Membership + return ret + } + return o.Memberships +} + +// GetMembershipsOk returns a tuple with the Memberships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MembershipList) GetMembershipsOk() ([]Membership, bool) { + if o == nil || IsNil(o.Memberships) { + return nil, false + } + return o.Memberships, true +} + +// HasMemberships returns a boolean if a field has been set. +func (o *MembershipList) HasMemberships() bool { + if o != nil && !IsNil(o.Memberships) { + return true + } + + return false +} + +// SetMemberships gets a reference to the given []Membership and assigns it to the Memberships field. +func (o *MembershipList) SetMemberships(v []Membership) { + o.Memberships = v +} + +func (o MembershipList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MembershipList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Memberships) { + toSerialize["memberships"] = o.Memberships + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MembershipList) UnmarshalJSON(data []byte) (err error) { + varMembershipList := _MembershipList{} + + err = json.Unmarshal(data, &varMembershipList) + + if err != nil { + return err + } + + *o = MembershipList(varMembershipList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "memberships") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMembershipList struct { + value *MembershipList + isSet bool +} + +func (v NullableMembershipList) Get() *MembershipList { + return v.value +} + +func (v *NullableMembershipList) Set(val *MembershipList) { + v.value = val + v.isSet = true +} + +func (v NullableMembershipList) IsSet() bool { + return v.isSet +} + +func (v *NullableMembershipList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMembershipList(val *MembershipList) *NullableMembershipList { + return &NullableMembershipList{value: val, isSet: true} +} + +func (v NullableMembershipList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMembershipList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_meta.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_meta.go new file mode 100644 index 00000000..3c86a384 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_meta.go @@ -0,0 +1,413 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Meta type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Meta{} + +// Meta struct for Meta +type Meta struct { + First *Href `json:"first,omitempty"` + Last *Href `json:"last,omitempty"` + Next *Href `json:"next,omitempty"` + Previous *Href `json:"previous,omitempty"` + Self *Href `json:"self,omitempty"` + Total *int32 `json:"total,omitempty"` + CurrentPage *int32 `json:"current_page,omitempty"` + LastPage *int32 `json:"last_page,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Meta Meta + +// NewMeta instantiates a new Meta object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMeta() *Meta { + this := Meta{} + return &this +} + +// NewMetaWithDefaults instantiates a new Meta object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetaWithDefaults() *Meta { + this := Meta{} + return &this +} + +// GetFirst returns the First field value if set, zero value otherwise. +func (o *Meta) GetFirst() Href { + if o == nil || IsNil(o.First) { + var ret Href + return ret + } + return *o.First +} + +// GetFirstOk returns a tuple with the First field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Meta) GetFirstOk() (*Href, bool) { + if o == nil || IsNil(o.First) { + return nil, false + } + return o.First, true +} + +// HasFirst returns a boolean if a field has been set. +func (o *Meta) HasFirst() bool { + if o != nil && !IsNil(o.First) { + return true + } + + return false +} + +// SetFirst gets a reference to the given Href and assigns it to the First field. +func (o *Meta) SetFirst(v Href) { + o.First = &v +} + +// GetLast returns the Last field value if set, zero value otherwise. +func (o *Meta) GetLast() Href { + if o == nil || IsNil(o.Last) { + var ret Href + return ret + } + return *o.Last +} + +// GetLastOk returns a tuple with the Last field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Meta) GetLastOk() (*Href, bool) { + if o == nil || IsNil(o.Last) { + return nil, false + } + return o.Last, true +} + +// HasLast returns a boolean if a field has been set. +func (o *Meta) HasLast() bool { + if o != nil && !IsNil(o.Last) { + return true + } + + return false +} + +// SetLast gets a reference to the given Href and assigns it to the Last field. +func (o *Meta) SetLast(v Href) { + o.Last = &v +} + +// GetNext returns the Next field value if set, zero value otherwise. +func (o *Meta) GetNext() Href { + if o == nil || IsNil(o.Next) { + var ret Href + return ret + } + return *o.Next +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Meta) GetNextOk() (*Href, bool) { + if o == nil || IsNil(o.Next) { + return nil, false + } + return o.Next, true +} + +// HasNext returns a boolean if a field has been set. +func (o *Meta) HasNext() bool { + if o != nil && !IsNil(o.Next) { + return true + } + + return false +} + +// SetNext gets a reference to the given Href and assigns it to the Next field. +func (o *Meta) SetNext(v Href) { + o.Next = &v +} + +// GetPrevious returns the Previous field value if set, zero value otherwise. +func (o *Meta) GetPrevious() Href { + if o == nil || IsNil(o.Previous) { + var ret Href + return ret + } + return *o.Previous +} + +// GetPreviousOk returns a tuple with the Previous field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Meta) GetPreviousOk() (*Href, bool) { + if o == nil || IsNil(o.Previous) { + return nil, false + } + return o.Previous, true +} + +// HasPrevious returns a boolean if a field has been set. +func (o *Meta) HasPrevious() bool { + if o != nil && !IsNil(o.Previous) { + return true + } + + return false +} + +// SetPrevious gets a reference to the given Href and assigns it to the Previous field. +func (o *Meta) SetPrevious(v Href) { + o.Previous = &v +} + +// GetSelf returns the Self field value if set, zero value otherwise. +func (o *Meta) GetSelf() Href { + if o == nil || IsNil(o.Self) { + var ret Href + return ret + } + return *o.Self +} + +// GetSelfOk returns a tuple with the Self field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Meta) GetSelfOk() (*Href, bool) { + if o == nil || IsNil(o.Self) { + return nil, false + } + return o.Self, true +} + +// HasSelf returns a boolean if a field has been set. +func (o *Meta) HasSelf() bool { + if o != nil && !IsNil(o.Self) { + return true + } + + return false +} + +// SetSelf gets a reference to the given Href and assigns it to the Self field. +func (o *Meta) SetSelf(v Href) { + o.Self = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *Meta) GetTotal() int32 { + if o == nil || IsNil(o.Total) { + var ret int32 + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Meta) GetTotalOk() (*int32, bool) { + if o == nil || IsNil(o.Total) { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *Meta) HasTotal() bool { + if o != nil && !IsNil(o.Total) { + return true + } + + return false +} + +// SetTotal gets a reference to the given int32 and assigns it to the Total field. +func (o *Meta) SetTotal(v int32) { + o.Total = &v +} + +// GetCurrentPage returns the CurrentPage field value if set, zero value otherwise. +func (o *Meta) GetCurrentPage() int32 { + if o == nil || IsNil(o.CurrentPage) { + var ret int32 + return ret + } + return *o.CurrentPage +} + +// GetCurrentPageOk returns a tuple with the CurrentPage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Meta) GetCurrentPageOk() (*int32, bool) { + if o == nil || IsNil(o.CurrentPage) { + return nil, false + } + return o.CurrentPage, true +} + +// HasCurrentPage returns a boolean if a field has been set. +func (o *Meta) HasCurrentPage() bool { + if o != nil && !IsNil(o.CurrentPage) { + return true + } + + return false +} + +// SetCurrentPage gets a reference to the given int32 and assigns it to the CurrentPage field. +func (o *Meta) SetCurrentPage(v int32) { + o.CurrentPage = &v +} + +// GetLastPage returns the LastPage field value if set, zero value otherwise. +func (o *Meta) GetLastPage() int32 { + if o == nil || IsNil(o.LastPage) { + var ret int32 + return ret + } + return *o.LastPage +} + +// GetLastPageOk returns a tuple with the LastPage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Meta) GetLastPageOk() (*int32, bool) { + if o == nil || IsNil(o.LastPage) { + return nil, false + } + return o.LastPage, true +} + +// HasLastPage returns a boolean if a field has been set. +func (o *Meta) HasLastPage() bool { + if o != nil && !IsNil(o.LastPage) { + return true + } + + return false +} + +// SetLastPage gets a reference to the given int32 and assigns it to the LastPage field. +func (o *Meta) SetLastPage(v int32) { + o.LastPage = &v +} + +func (o Meta) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Meta) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.First) { + toSerialize["first"] = o.First + } + if !IsNil(o.Last) { + toSerialize["last"] = o.Last + } + if !IsNil(o.Next) { + toSerialize["next"] = o.Next + } + if !IsNil(o.Previous) { + toSerialize["previous"] = o.Previous + } + if !IsNil(o.Self) { + toSerialize["self"] = o.Self + } + if !IsNil(o.Total) { + toSerialize["total"] = o.Total + } + if !IsNil(o.CurrentPage) { + toSerialize["current_page"] = o.CurrentPage + } + if !IsNil(o.LastPage) { + toSerialize["last_page"] = o.LastPage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Meta) UnmarshalJSON(data []byte) (err error) { + varMeta := _Meta{} + + err = json.Unmarshal(data, &varMeta) + + if err != nil { + return err + } + + *o = Meta(varMeta) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "first") + delete(additionalProperties, "last") + delete(additionalProperties, "next") + delete(additionalProperties, "previous") + delete(additionalProperties, "self") + delete(additionalProperties, "total") + delete(additionalProperties, "current_page") + delete(additionalProperties, "last_page") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMeta struct { + value *Meta + isSet bool +} + +func (v NullableMeta) Get() *Meta { + return v.value +} + +func (v *NullableMeta) Set(val *Meta) { + v.value = val + v.isSet = true +} + +func (v NullableMeta) IsSet() bool { + return v.isSet +} + +func (v *NullableMeta) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMeta(val *Meta) *NullableMeta { + return &NullableMeta{value: val, isSet: true} +} + +func (v NullableMeta) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMeta) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata.go new file mode 100644 index 00000000..80536e65 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata.go @@ -0,0 +1,788 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Metadata type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Metadata{} + +// Metadata struct for Metadata +type Metadata struct { + Class *string `json:"class,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + // The facility code of the instance + Facility *string `json:"facility,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Id *string `json:"id,omitempty"` + Iqn *string `json:"iqn,omitempty"` + // The metro code of the instance + Metro *string `json:"metro,omitempty"` + Network *MetadataNetwork `json:"network,omitempty"` + OperatingSystem map[string]interface{} `json:"operating_system,omitempty"` + // The plan slug of the instance + Plan *string `json:"plan,omitempty"` + // An array of the private subnets + PrivateSubnets []string `json:"private_subnets,omitempty"` + Reserved *bool `json:"reserved,omitempty"` + // The specs of the plan version of the instance + Specs map[string]interface{} `json:"specs,omitempty"` + SshKeys []string `json:"ssh_keys,omitempty"` + SwitchShortId *string `json:"switch_short_id,omitempty"` + State *DeviceState `json:"state,omitempty"` + Tags []string `json:"tags,omitempty"` + Volumes []string `json:"volumes,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Metadata Metadata + +// NewMetadata instantiates a new Metadata object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadata() *Metadata { + this := Metadata{} + return &this +} + +// NewMetadataWithDefaults instantiates a new Metadata object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataWithDefaults() *Metadata { + this := Metadata{} + return &this +} + +// GetClass returns the Class field value if set, zero value otherwise. +func (o *Metadata) GetClass() string { + if o == nil || IsNil(o.Class) { + var ret string + return ret + } + return *o.Class +} + +// GetClassOk returns a tuple with the Class field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetClassOk() (*string, bool) { + if o == nil || IsNil(o.Class) { + return nil, false + } + return o.Class, true +} + +// HasClass returns a boolean if a field has been set. +func (o *Metadata) HasClass() bool { + if o != nil && !IsNil(o.Class) { + return true + } + + return false +} + +// SetClass gets a reference to the given string and assigns it to the Class field. +func (o *Metadata) SetClass(v string) { + o.Class = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *Metadata) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *Metadata) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *Metadata) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetFacility returns the Facility field value if set, zero value otherwise. +func (o *Metadata) GetFacility() string { + if o == nil || IsNil(o.Facility) { + var ret string + return ret + } + return *o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetFacilityOk() (*string, bool) { + if o == nil || IsNil(o.Facility) { + return nil, false + } + return o.Facility, true +} + +// HasFacility returns a boolean if a field has been set. +func (o *Metadata) HasFacility() bool { + if o != nil && !IsNil(o.Facility) { + return true + } + + return false +} + +// SetFacility gets a reference to the given string and assigns it to the Facility field. +func (o *Metadata) SetFacility(v string) { + o.Facility = &v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *Metadata) GetHostname() string { + if o == nil || IsNil(o.Hostname) { + var ret string + return ret + } + return *o.Hostname +} + +// GetHostnameOk returns a tuple with the Hostname field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetHostnameOk() (*string, bool) { + if o == nil || IsNil(o.Hostname) { + return nil, false + } + return o.Hostname, true +} + +// HasHostname returns a boolean if a field has been set. +func (o *Metadata) HasHostname() bool { + if o != nil && !IsNil(o.Hostname) { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *Metadata) SetHostname(v string) { + o.Hostname = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Metadata) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Metadata) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Metadata) SetId(v string) { + o.Id = &v +} + +// GetIqn returns the Iqn field value if set, zero value otherwise. +func (o *Metadata) GetIqn() string { + if o == nil || IsNil(o.Iqn) { + var ret string + return ret + } + return *o.Iqn +} + +// GetIqnOk returns a tuple with the Iqn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetIqnOk() (*string, bool) { + if o == nil || IsNil(o.Iqn) { + return nil, false + } + return o.Iqn, true +} + +// HasIqn returns a boolean if a field has been set. +func (o *Metadata) HasIqn() bool { + if o != nil && !IsNil(o.Iqn) { + return true + } + + return false +} + +// SetIqn gets a reference to the given string and assigns it to the Iqn field. +func (o *Metadata) SetIqn(v string) { + o.Iqn = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *Metadata) GetMetro() string { + if o == nil || IsNil(o.Metro) { + var ret string + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetMetroOk() (*string, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *Metadata) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given string and assigns it to the Metro field. +func (o *Metadata) SetMetro(v string) { + o.Metro = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *Metadata) GetNetwork() MetadataNetwork { + if o == nil || IsNil(o.Network) { + var ret MetadataNetwork + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetNetworkOk() (*MetadataNetwork, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *Metadata) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given MetadataNetwork and assigns it to the Network field. +func (o *Metadata) SetNetwork(v MetadataNetwork) { + o.Network = &v +} + +// GetOperatingSystem returns the OperatingSystem field value if set, zero value otherwise. +func (o *Metadata) GetOperatingSystem() map[string]interface{} { + if o == nil || IsNil(o.OperatingSystem) { + var ret map[string]interface{} + return ret + } + return o.OperatingSystem +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetOperatingSystemOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.OperatingSystem) { + return map[string]interface{}{}, false + } + return o.OperatingSystem, true +} + +// HasOperatingSystem returns a boolean if a field has been set. +func (o *Metadata) HasOperatingSystem() bool { + if o != nil && !IsNil(o.OperatingSystem) { + return true + } + + return false +} + +// SetOperatingSystem gets a reference to the given map[string]interface{} and assigns it to the OperatingSystem field. +func (o *Metadata) SetOperatingSystem(v map[string]interface{}) { + o.OperatingSystem = v +} + +// GetPlan returns the Plan field value if set, zero value otherwise. +func (o *Metadata) GetPlan() string { + if o == nil || IsNil(o.Plan) { + var ret string + return ret + } + return *o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetPlanOk() (*string, bool) { + if o == nil || IsNil(o.Plan) { + return nil, false + } + return o.Plan, true +} + +// HasPlan returns a boolean if a field has been set. +func (o *Metadata) HasPlan() bool { + if o != nil && !IsNil(o.Plan) { + return true + } + + return false +} + +// SetPlan gets a reference to the given string and assigns it to the Plan field. +func (o *Metadata) SetPlan(v string) { + o.Plan = &v +} + +// GetPrivateSubnets returns the PrivateSubnets field value if set, zero value otherwise. +func (o *Metadata) GetPrivateSubnets() []string { + if o == nil || IsNil(o.PrivateSubnets) { + var ret []string + return ret + } + return o.PrivateSubnets +} + +// GetPrivateSubnetsOk returns a tuple with the PrivateSubnets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetPrivateSubnetsOk() ([]string, bool) { + if o == nil || IsNil(o.PrivateSubnets) { + return nil, false + } + return o.PrivateSubnets, true +} + +// HasPrivateSubnets returns a boolean if a field has been set. +func (o *Metadata) HasPrivateSubnets() bool { + if o != nil && !IsNil(o.PrivateSubnets) { + return true + } + + return false +} + +// SetPrivateSubnets gets a reference to the given []string and assigns it to the PrivateSubnets field. +func (o *Metadata) SetPrivateSubnets(v []string) { + o.PrivateSubnets = v +} + +// GetReserved returns the Reserved field value if set, zero value otherwise. +func (o *Metadata) GetReserved() bool { + if o == nil || IsNil(o.Reserved) { + var ret bool + return ret + } + return *o.Reserved +} + +// GetReservedOk returns a tuple with the Reserved field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetReservedOk() (*bool, bool) { + if o == nil || IsNil(o.Reserved) { + return nil, false + } + return o.Reserved, true +} + +// HasReserved returns a boolean if a field has been set. +func (o *Metadata) HasReserved() bool { + if o != nil && !IsNil(o.Reserved) { + return true + } + + return false +} + +// SetReserved gets a reference to the given bool and assigns it to the Reserved field. +func (o *Metadata) SetReserved(v bool) { + o.Reserved = &v +} + +// GetSpecs returns the Specs field value if set, zero value otherwise. +func (o *Metadata) GetSpecs() map[string]interface{} { + if o == nil || IsNil(o.Specs) { + var ret map[string]interface{} + return ret + } + return o.Specs +} + +// GetSpecsOk returns a tuple with the Specs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetSpecsOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Specs) { + return map[string]interface{}{}, false + } + return o.Specs, true +} + +// HasSpecs returns a boolean if a field has been set. +func (o *Metadata) HasSpecs() bool { + if o != nil && !IsNil(o.Specs) { + return true + } + + return false +} + +// SetSpecs gets a reference to the given map[string]interface{} and assigns it to the Specs field. +func (o *Metadata) SetSpecs(v map[string]interface{}) { + o.Specs = v +} + +// GetSshKeys returns the SshKeys field value if set, zero value otherwise. +func (o *Metadata) GetSshKeys() []string { + if o == nil || IsNil(o.SshKeys) { + var ret []string + return ret + } + return o.SshKeys +} + +// GetSshKeysOk returns a tuple with the SshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.SshKeys) { + return nil, false + } + return o.SshKeys, true +} + +// HasSshKeys returns a boolean if a field has been set. +func (o *Metadata) HasSshKeys() bool { + if o != nil && !IsNil(o.SshKeys) { + return true + } + + return false +} + +// SetSshKeys gets a reference to the given []string and assigns it to the SshKeys field. +func (o *Metadata) SetSshKeys(v []string) { + o.SshKeys = v +} + +// GetSwitchShortId returns the SwitchShortId field value if set, zero value otherwise. +func (o *Metadata) GetSwitchShortId() string { + if o == nil || IsNil(o.SwitchShortId) { + var ret string + return ret + } + return *o.SwitchShortId +} + +// GetSwitchShortIdOk returns a tuple with the SwitchShortId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetSwitchShortIdOk() (*string, bool) { + if o == nil || IsNil(o.SwitchShortId) { + return nil, false + } + return o.SwitchShortId, true +} + +// HasSwitchShortId returns a boolean if a field has been set. +func (o *Metadata) HasSwitchShortId() bool { + if o != nil && !IsNil(o.SwitchShortId) { + return true + } + + return false +} + +// SetSwitchShortId gets a reference to the given string and assigns it to the SwitchShortId field. +func (o *Metadata) SetSwitchShortId(v string) { + o.SwitchShortId = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Metadata) GetState() DeviceState { + if o == nil || IsNil(o.State) { + var ret DeviceState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetStateOk() (*DeviceState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Metadata) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given DeviceState and assigns it to the State field. +func (o *Metadata) SetState(v DeviceState) { + o.State = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Metadata) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *Metadata) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *Metadata) SetTags(v []string) { + o.Tags = v +} + +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *Metadata) GetVolumes() []string { + if o == nil || IsNil(o.Volumes) { + var ret []string + return ret + } + return o.Volumes +} + +// GetVolumesOk returns a tuple with the Volumes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metadata) GetVolumesOk() ([]string, bool) { + if o == nil || IsNil(o.Volumes) { + return nil, false + } + return o.Volumes, true +} + +// HasVolumes returns a boolean if a field has been set. +func (o *Metadata) HasVolumes() bool { + if o != nil && !IsNil(o.Volumes) { + return true + } + + return false +} + +// SetVolumes gets a reference to the given []string and assigns it to the Volumes field. +func (o *Metadata) SetVolumes(v []string) { + o.Volumes = v +} + +func (o Metadata) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Metadata) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Class) { + toSerialize["class"] = o.Class + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Facility) { + toSerialize["facility"] = o.Facility + } + if !IsNil(o.Hostname) { + toSerialize["hostname"] = o.Hostname + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Iqn) { + toSerialize["iqn"] = o.Iqn + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.OperatingSystem) { + toSerialize["operating_system"] = o.OperatingSystem + } + if !IsNil(o.Plan) { + toSerialize["plan"] = o.Plan + } + if !IsNil(o.PrivateSubnets) { + toSerialize["private_subnets"] = o.PrivateSubnets + } + if !IsNil(o.Reserved) { + toSerialize["reserved"] = o.Reserved + } + if !IsNil(o.Specs) { + toSerialize["specs"] = o.Specs + } + if !IsNil(o.SshKeys) { + toSerialize["ssh_keys"] = o.SshKeys + } + if !IsNil(o.SwitchShortId) { + toSerialize["switch_short_id"] = o.SwitchShortId + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Volumes) { + toSerialize["volumes"] = o.Volumes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Metadata) UnmarshalJSON(data []byte) (err error) { + varMetadata := _Metadata{} + + err = json.Unmarshal(data, &varMetadata) + + if err != nil { + return err + } + + *o = Metadata(varMetadata) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "class") + delete(additionalProperties, "customdata") + delete(additionalProperties, "facility") + delete(additionalProperties, "hostname") + delete(additionalProperties, "id") + delete(additionalProperties, "iqn") + delete(additionalProperties, "metro") + delete(additionalProperties, "network") + delete(additionalProperties, "operating_system") + delete(additionalProperties, "plan") + delete(additionalProperties, "private_subnets") + delete(additionalProperties, "reserved") + delete(additionalProperties, "specs") + delete(additionalProperties, "ssh_keys") + delete(additionalProperties, "switch_short_id") + delete(additionalProperties, "state") + delete(additionalProperties, "tags") + delete(additionalProperties, "volumes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetadata struct { + value *Metadata + isSet bool +} + +func (v NullableMetadata) Get() *Metadata { + return v.value +} + +func (v *NullableMetadata) Set(val *Metadata) { + v.value = val + v.isSet = true +} + +func (v NullableMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadata(val *Metadata) *NullableMetadata { + return &NullableMetadata{value: val, isSet: true} +} + +func (v NullableMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network.go new file mode 100644 index 00000000..66c708a0 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the MetadataNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetadataNetwork{} + +// MetadataNetwork struct for MetadataNetwork +type MetadataNetwork struct { + Addresses []string `json:"addresses,omitempty"` + Interfaces []map[string]interface{} `json:"interfaces,omitempty"` + Network *MetadataNetworkNetwork `json:"network,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MetadataNetwork MetadataNetwork + +// NewMetadataNetwork instantiates a new MetadataNetwork object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadataNetwork() *MetadataNetwork { + this := MetadataNetwork{} + return &this +} + +// NewMetadataNetworkWithDefaults instantiates a new MetadataNetwork object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataNetworkWithDefaults() *MetadataNetwork { + this := MetadataNetwork{} + return &this +} + +// GetAddresses returns the Addresses field value if set, zero value otherwise. +func (o *MetadataNetwork) GetAddresses() []string { + if o == nil || IsNil(o.Addresses) { + var ret []string + return ret + } + return o.Addresses +} + +// GetAddressesOk returns a tuple with the Addresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataNetwork) GetAddressesOk() ([]string, bool) { + if o == nil || IsNil(o.Addresses) { + return nil, false + } + return o.Addresses, true +} + +// HasAddresses returns a boolean if a field has been set. +func (o *MetadataNetwork) HasAddresses() bool { + if o != nil && !IsNil(o.Addresses) { + return true + } + + return false +} + +// SetAddresses gets a reference to the given []string and assigns it to the Addresses field. +func (o *MetadataNetwork) SetAddresses(v []string) { + o.Addresses = v +} + +// GetInterfaces returns the Interfaces field value if set, zero value otherwise. +func (o *MetadataNetwork) GetInterfaces() []map[string]interface{} { + if o == nil || IsNil(o.Interfaces) { + var ret []map[string]interface{} + return ret + } + return o.Interfaces +} + +// GetInterfacesOk returns a tuple with the Interfaces field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataNetwork) GetInterfacesOk() ([]map[string]interface{}, bool) { + if o == nil || IsNil(o.Interfaces) { + return nil, false + } + return o.Interfaces, true +} + +// HasInterfaces returns a boolean if a field has been set. +func (o *MetadataNetwork) HasInterfaces() bool { + if o != nil && !IsNil(o.Interfaces) { + return true + } + + return false +} + +// SetInterfaces gets a reference to the given []map[string]interface{} and assigns it to the Interfaces field. +func (o *MetadataNetwork) SetInterfaces(v []map[string]interface{}) { + o.Interfaces = v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *MetadataNetwork) GetNetwork() MetadataNetworkNetwork { + if o == nil || IsNil(o.Network) { + var ret MetadataNetworkNetwork + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataNetwork) GetNetworkOk() (*MetadataNetworkNetwork, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *MetadataNetwork) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given MetadataNetworkNetwork and assigns it to the Network field. +func (o *MetadataNetwork) SetNetwork(v MetadataNetworkNetwork) { + o.Network = &v +} + +func (o MetadataNetwork) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetadataNetwork) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Addresses) { + toSerialize["addresses"] = o.Addresses + } + if !IsNil(o.Interfaces) { + toSerialize["interfaces"] = o.Interfaces + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MetadataNetwork) UnmarshalJSON(data []byte) (err error) { + varMetadataNetwork := _MetadataNetwork{} + + err = json.Unmarshal(data, &varMetadataNetwork) + + if err != nil { + return err + } + + *o = MetadataNetwork(varMetadataNetwork) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "addresses") + delete(additionalProperties, "interfaces") + delete(additionalProperties, "network") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetadataNetwork struct { + value *MetadataNetwork + isSet bool +} + +func (v NullableMetadataNetwork) Get() *MetadataNetwork { + return v.value +} + +func (v *NullableMetadataNetwork) Set(val *MetadataNetwork) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataNetwork(val *MetadataNetwork) *NullableMetadataNetwork { + return &NullableMetadataNetwork{value: val, isSet: true} +} + +func (v NullableMetadataNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network_network.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network_network.go new file mode 100644 index 00000000..80f7f0b7 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network_network.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the MetadataNetworkNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetadataNetworkNetwork{} + +// MetadataNetworkNetwork struct for MetadataNetworkNetwork +type MetadataNetworkNetwork struct { + Bonding *MetadataNetworkNetworkBonding `json:"bonding,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MetadataNetworkNetwork MetadataNetworkNetwork + +// NewMetadataNetworkNetwork instantiates a new MetadataNetworkNetwork object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadataNetworkNetwork() *MetadataNetworkNetwork { + this := MetadataNetworkNetwork{} + return &this +} + +// NewMetadataNetworkNetworkWithDefaults instantiates a new MetadataNetworkNetwork object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataNetworkNetworkWithDefaults() *MetadataNetworkNetwork { + this := MetadataNetworkNetwork{} + return &this +} + +// GetBonding returns the Bonding field value if set, zero value otherwise. +func (o *MetadataNetworkNetwork) GetBonding() MetadataNetworkNetworkBonding { + if o == nil || IsNil(o.Bonding) { + var ret MetadataNetworkNetworkBonding + return ret + } + return *o.Bonding +} + +// GetBondingOk returns a tuple with the Bonding field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataNetworkNetwork) GetBondingOk() (*MetadataNetworkNetworkBonding, bool) { + if o == nil || IsNil(o.Bonding) { + return nil, false + } + return o.Bonding, true +} + +// HasBonding returns a boolean if a field has been set. +func (o *MetadataNetworkNetwork) HasBonding() bool { + if o != nil && !IsNil(o.Bonding) { + return true + } + + return false +} + +// SetBonding gets a reference to the given MetadataNetworkNetworkBonding and assigns it to the Bonding field. +func (o *MetadataNetworkNetwork) SetBonding(v MetadataNetworkNetworkBonding) { + o.Bonding = &v +} + +func (o MetadataNetworkNetwork) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetadataNetworkNetwork) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Bonding) { + toSerialize["bonding"] = o.Bonding + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MetadataNetworkNetwork) UnmarshalJSON(data []byte) (err error) { + varMetadataNetworkNetwork := _MetadataNetworkNetwork{} + + err = json.Unmarshal(data, &varMetadataNetworkNetwork) + + if err != nil { + return err + } + + *o = MetadataNetworkNetwork(varMetadataNetworkNetwork) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bonding") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetadataNetworkNetwork struct { + value *MetadataNetworkNetwork + isSet bool +} + +func (v NullableMetadataNetworkNetwork) Get() *MetadataNetworkNetwork { + return v.value +} + +func (v *NullableMetadataNetworkNetwork) Set(val *MetadataNetworkNetwork) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataNetworkNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataNetworkNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataNetworkNetwork(val *MetadataNetworkNetwork) *NullableMetadataNetworkNetwork { + return &NullableMetadataNetworkNetwork{value: val, isSet: true} +} + +func (v NullableMetadataNetworkNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataNetworkNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network_network_bonding.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network_network_bonding.go new file mode 100644 index 00000000..3c9c22d1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metadata_network_network_bonding.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the MetadataNetworkNetworkBonding type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetadataNetworkNetworkBonding{} + +// MetadataNetworkNetworkBonding struct for MetadataNetworkNetworkBonding +type MetadataNetworkNetworkBonding struct { + LinkAggregation *string `json:"link_aggregation,omitempty"` + Mac *string `json:"mac,omitempty"` + Mode *int32 `json:"mode,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MetadataNetworkNetworkBonding MetadataNetworkNetworkBonding + +// NewMetadataNetworkNetworkBonding instantiates a new MetadataNetworkNetworkBonding object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadataNetworkNetworkBonding() *MetadataNetworkNetworkBonding { + this := MetadataNetworkNetworkBonding{} + return &this +} + +// NewMetadataNetworkNetworkBondingWithDefaults instantiates a new MetadataNetworkNetworkBonding object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataNetworkNetworkBondingWithDefaults() *MetadataNetworkNetworkBonding { + this := MetadataNetworkNetworkBonding{} + return &this +} + +// GetLinkAggregation returns the LinkAggregation field value if set, zero value otherwise. +func (o *MetadataNetworkNetworkBonding) GetLinkAggregation() string { + if o == nil || IsNil(o.LinkAggregation) { + var ret string + return ret + } + return *o.LinkAggregation +} + +// GetLinkAggregationOk returns a tuple with the LinkAggregation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataNetworkNetworkBonding) GetLinkAggregationOk() (*string, bool) { + if o == nil || IsNil(o.LinkAggregation) { + return nil, false + } + return o.LinkAggregation, true +} + +// HasLinkAggregation returns a boolean if a field has been set. +func (o *MetadataNetworkNetworkBonding) HasLinkAggregation() bool { + if o != nil && !IsNil(o.LinkAggregation) { + return true + } + + return false +} + +// SetLinkAggregation gets a reference to the given string and assigns it to the LinkAggregation field. +func (o *MetadataNetworkNetworkBonding) SetLinkAggregation(v string) { + o.LinkAggregation = &v +} + +// GetMac returns the Mac field value if set, zero value otherwise. +func (o *MetadataNetworkNetworkBonding) GetMac() string { + if o == nil || IsNil(o.Mac) { + var ret string + return ret + } + return *o.Mac +} + +// GetMacOk returns a tuple with the Mac field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataNetworkNetworkBonding) GetMacOk() (*string, bool) { + if o == nil || IsNil(o.Mac) { + return nil, false + } + return o.Mac, true +} + +// HasMac returns a boolean if a field has been set. +func (o *MetadataNetworkNetworkBonding) HasMac() bool { + if o != nil && !IsNil(o.Mac) { + return true + } + + return false +} + +// SetMac gets a reference to the given string and assigns it to the Mac field. +func (o *MetadataNetworkNetworkBonding) SetMac(v string) { + o.Mac = &v +} + +// GetMode returns the Mode field value if set, zero value otherwise. +func (o *MetadataNetworkNetworkBonding) GetMode() int32 { + if o == nil || IsNil(o.Mode) { + var ret int32 + return ret + } + return *o.Mode +} + +// GetModeOk returns a tuple with the Mode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataNetworkNetworkBonding) GetModeOk() (*int32, bool) { + if o == nil || IsNil(o.Mode) { + return nil, false + } + return o.Mode, true +} + +// HasMode returns a boolean if a field has been set. +func (o *MetadataNetworkNetworkBonding) HasMode() bool { + if o != nil && !IsNil(o.Mode) { + return true + } + + return false +} + +// SetMode gets a reference to the given int32 and assigns it to the Mode field. +func (o *MetadataNetworkNetworkBonding) SetMode(v int32) { + o.Mode = &v +} + +func (o MetadataNetworkNetworkBonding) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetadataNetworkNetworkBonding) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.LinkAggregation) { + toSerialize["link_aggregation"] = o.LinkAggregation + } + if !IsNil(o.Mac) { + toSerialize["mac"] = o.Mac + } + if !IsNil(o.Mode) { + toSerialize["mode"] = o.Mode + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MetadataNetworkNetworkBonding) UnmarshalJSON(data []byte) (err error) { + varMetadataNetworkNetworkBonding := _MetadataNetworkNetworkBonding{} + + err = json.Unmarshal(data, &varMetadataNetworkNetworkBonding) + + if err != nil { + return err + } + + *o = MetadataNetworkNetworkBonding(varMetadataNetworkNetworkBonding) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "link_aggregation") + delete(additionalProperties, "mac") + delete(additionalProperties, "mode") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetadataNetworkNetworkBonding struct { + value *MetadataNetworkNetworkBonding + isSet bool +} + +func (v NullableMetadataNetworkNetworkBonding) Get() *MetadataNetworkNetworkBonding { + return v.value +} + +func (v *NullableMetadataNetworkNetworkBonding) Set(val *MetadataNetworkNetworkBonding) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataNetworkNetworkBonding) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataNetworkNetworkBonding) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataNetworkNetworkBonding(val *MetadataNetworkNetworkBonding) *NullableMetadataNetworkNetworkBonding { + return &NullableMetadataNetworkNetworkBonding{value: val, isSet: true} +} + +func (v NullableMetadataNetworkNetworkBonding) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataNetworkNetworkBonding) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway.go new file mode 100644 index 00000000..16722015 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway.go @@ -0,0 +1,451 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the MetalGateway type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetalGateway{} + +// MetalGateway struct for MetalGateway +type MetalGateway struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + CreatedBy *Href `json:"created_by,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + IpReservation *IPReservation `json:"ip_reservation,omitempty"` + Project *Project `json:"project,omitempty"` + State *MetalGatewayState `json:"state,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + VirtualNetwork *VirtualNetwork `json:"virtual_network,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MetalGateway MetalGateway + +// NewMetalGateway instantiates a new MetalGateway object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetalGateway() *MetalGateway { + this := MetalGateway{} + return &this +} + +// NewMetalGatewayWithDefaults instantiates a new MetalGateway object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetalGatewayWithDefaults() *MetalGateway { + this := MetalGateway{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *MetalGateway) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGateway) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *MetalGateway) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *MetalGateway) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *MetalGateway) GetCreatedBy() Href { + if o == nil || IsNil(o.CreatedBy) { + var ret Href + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGateway) GetCreatedByOk() (*Href, bool) { + if o == nil || IsNil(o.CreatedBy) { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *MetalGateway) HasCreatedBy() bool { + if o != nil && !IsNil(o.CreatedBy) { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given Href and assigns it to the CreatedBy field. +func (o *MetalGateway) SetCreatedBy(v Href) { + o.CreatedBy = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *MetalGateway) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGateway) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *MetalGateway) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *MetalGateway) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MetalGateway) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGateway) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MetalGateway) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MetalGateway) SetId(v string) { + o.Id = &v +} + +// GetIpReservation returns the IpReservation field value if set, zero value otherwise. +func (o *MetalGateway) GetIpReservation() IPReservation { + if o == nil || IsNil(o.IpReservation) { + var ret IPReservation + return ret + } + return *o.IpReservation +} + +// GetIpReservationOk returns a tuple with the IpReservation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGateway) GetIpReservationOk() (*IPReservation, bool) { + if o == nil || IsNil(o.IpReservation) { + return nil, false + } + return o.IpReservation, true +} + +// HasIpReservation returns a boolean if a field has been set. +func (o *MetalGateway) HasIpReservation() bool { + if o != nil && !IsNil(o.IpReservation) { + return true + } + + return false +} + +// SetIpReservation gets a reference to the given IPReservation and assigns it to the IpReservation field. +func (o *MetalGateway) SetIpReservation(v IPReservation) { + o.IpReservation = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *MetalGateway) GetProject() Project { + if o == nil || IsNil(o.Project) { + var ret Project + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGateway) GetProjectOk() (*Project, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *MetalGateway) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Project and assigns it to the Project field. +func (o *MetalGateway) SetProject(v Project) { + o.Project = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *MetalGateway) GetState() MetalGatewayState { + if o == nil || IsNil(o.State) { + var ret MetalGatewayState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGateway) GetStateOk() (*MetalGatewayState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *MetalGateway) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given MetalGatewayState and assigns it to the State field. +func (o *MetalGateway) SetState(v MetalGatewayState) { + o.State = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *MetalGateway) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGateway) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *MetalGateway) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *MetalGateway) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetVirtualNetwork returns the VirtualNetwork field value if set, zero value otherwise. +func (o *MetalGateway) GetVirtualNetwork() VirtualNetwork { + if o == nil || IsNil(o.VirtualNetwork) { + var ret VirtualNetwork + return ret + } + return *o.VirtualNetwork +} + +// GetVirtualNetworkOk returns a tuple with the VirtualNetwork field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGateway) GetVirtualNetworkOk() (*VirtualNetwork, bool) { + if o == nil || IsNil(o.VirtualNetwork) { + return nil, false + } + return o.VirtualNetwork, true +} + +// HasVirtualNetwork returns a boolean if a field has been set. +func (o *MetalGateway) HasVirtualNetwork() bool { + if o != nil && !IsNil(o.VirtualNetwork) { + return true + } + + return false +} + +// SetVirtualNetwork gets a reference to the given VirtualNetwork and assigns it to the VirtualNetwork field. +func (o *MetalGateway) SetVirtualNetwork(v VirtualNetwork) { + o.VirtualNetwork = &v +} + +func (o MetalGateway) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetalGateway) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.CreatedBy) { + toSerialize["created_by"] = o.CreatedBy + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.IpReservation) { + toSerialize["ip_reservation"] = o.IpReservation + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.VirtualNetwork) { + toSerialize["virtual_network"] = o.VirtualNetwork + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MetalGateway) UnmarshalJSON(data []byte) (err error) { + varMetalGateway := _MetalGateway{} + + err = json.Unmarshal(data, &varMetalGateway) + + if err != nil { + return err + } + + *o = MetalGateway(varMetalGateway) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "created_by") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "ip_reservation") + delete(additionalProperties, "project") + delete(additionalProperties, "state") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "virtual_network") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetalGateway struct { + value *MetalGateway + isSet bool +} + +func (v NullableMetalGateway) Get() *MetalGateway { + return v.value +} + +func (v *NullableMetalGateway) Set(val *MetalGateway) { + v.value = val + v.isSet = true +} + +func (v NullableMetalGateway) IsSet() bool { + return v.isSet +} + +func (v *NullableMetalGateway) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetalGateway(val *MetalGateway) *NullableMetalGateway { + return &NullableMetalGateway{value: val, isSet: true} +} + +func (v NullableMetalGateway) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetalGateway) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_create_input.go new file mode 100644 index 00000000..7902d8bd --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_create_input.go @@ -0,0 +1,244 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the MetalGatewayCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetalGatewayCreateInput{} + +// MetalGatewayCreateInput struct for MetalGatewayCreateInput +type MetalGatewayCreateInput struct { + // The UUID of an IP reservation that belongs to the same project as where the metal gateway will be created in. This field is required unless the private IPv4 subnet size is specified. + IpReservationId *string `json:"ip_reservation_id,omitempty"` + // The subnet size (8, 16, 32, 64, or 128) of the private IPv4 reservation that will be created for the metal gateway. This field is required unless a project IP reservation was specified. Please keep in mind that the number of private metal gateway ranges are limited per project. If you would like to increase the limit per project, please contact support for assistance. + PrivateIpv4SubnetSize *int32 `json:"private_ipv4_subnet_size,omitempty"` + // The UUID of a metro virtual network that belongs to the same project as where the metal gateway will be created in. + VirtualNetworkId string `json:"virtual_network_id"` + AdditionalProperties map[string]interface{} +} + +type _MetalGatewayCreateInput MetalGatewayCreateInput + +// NewMetalGatewayCreateInput instantiates a new MetalGatewayCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetalGatewayCreateInput(virtualNetworkId string) *MetalGatewayCreateInput { + this := MetalGatewayCreateInput{} + this.VirtualNetworkId = virtualNetworkId + return &this +} + +// NewMetalGatewayCreateInputWithDefaults instantiates a new MetalGatewayCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetalGatewayCreateInputWithDefaults() *MetalGatewayCreateInput { + this := MetalGatewayCreateInput{} + return &this +} + +// GetIpReservationId returns the IpReservationId field value if set, zero value otherwise. +func (o *MetalGatewayCreateInput) GetIpReservationId() string { + if o == nil || IsNil(o.IpReservationId) { + var ret string + return ret + } + return *o.IpReservationId +} + +// GetIpReservationIdOk returns a tuple with the IpReservationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayCreateInput) GetIpReservationIdOk() (*string, bool) { + if o == nil || IsNil(o.IpReservationId) { + return nil, false + } + return o.IpReservationId, true +} + +// HasIpReservationId returns a boolean if a field has been set. +func (o *MetalGatewayCreateInput) HasIpReservationId() bool { + if o != nil && !IsNil(o.IpReservationId) { + return true + } + + return false +} + +// SetIpReservationId gets a reference to the given string and assigns it to the IpReservationId field. +func (o *MetalGatewayCreateInput) SetIpReservationId(v string) { + o.IpReservationId = &v +} + +// GetPrivateIpv4SubnetSize returns the PrivateIpv4SubnetSize field value if set, zero value otherwise. +func (o *MetalGatewayCreateInput) GetPrivateIpv4SubnetSize() int32 { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + var ret int32 + return ret + } + return *o.PrivateIpv4SubnetSize +} + +// GetPrivateIpv4SubnetSizeOk returns a tuple with the PrivateIpv4SubnetSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayCreateInput) GetPrivateIpv4SubnetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + return nil, false + } + return o.PrivateIpv4SubnetSize, true +} + +// HasPrivateIpv4SubnetSize returns a boolean if a field has been set. +func (o *MetalGatewayCreateInput) HasPrivateIpv4SubnetSize() bool { + if o != nil && !IsNil(o.PrivateIpv4SubnetSize) { + return true + } + + return false +} + +// SetPrivateIpv4SubnetSize gets a reference to the given int32 and assigns it to the PrivateIpv4SubnetSize field. +func (o *MetalGatewayCreateInput) SetPrivateIpv4SubnetSize(v int32) { + o.PrivateIpv4SubnetSize = &v +} + +// GetVirtualNetworkId returns the VirtualNetworkId field value +func (o *MetalGatewayCreateInput) GetVirtualNetworkId() string { + if o == nil { + var ret string + return ret + } + + return o.VirtualNetworkId +} + +// GetVirtualNetworkIdOk returns a tuple with the VirtualNetworkId field value +// and a boolean to check if the value has been set. +func (o *MetalGatewayCreateInput) GetVirtualNetworkIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.VirtualNetworkId, true +} + +// SetVirtualNetworkId sets field value +func (o *MetalGatewayCreateInput) SetVirtualNetworkId(v string) { + o.VirtualNetworkId = v +} + +func (o MetalGatewayCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetalGatewayCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.IpReservationId) { + toSerialize["ip_reservation_id"] = o.IpReservationId + } + if !IsNil(o.PrivateIpv4SubnetSize) { + toSerialize["private_ipv4_subnet_size"] = o.PrivateIpv4SubnetSize + } + toSerialize["virtual_network_id"] = o.VirtualNetworkId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MetalGatewayCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "virtual_network_id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varMetalGatewayCreateInput := _MetalGatewayCreateInput{} + + err = json.Unmarshal(data, &varMetalGatewayCreateInput) + + if err != nil { + return err + } + + *o = MetalGatewayCreateInput(varMetalGatewayCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ip_reservation_id") + delete(additionalProperties, "private_ipv4_subnet_size") + delete(additionalProperties, "virtual_network_id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetalGatewayCreateInput struct { + value *MetalGatewayCreateInput + isSet bool +} + +func (v NullableMetalGatewayCreateInput) Get() *MetalGatewayCreateInput { + return v.value +} + +func (v *NullableMetalGatewayCreateInput) Set(val *MetalGatewayCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableMetalGatewayCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableMetalGatewayCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetalGatewayCreateInput(val *MetalGatewayCreateInput) *NullableMetalGatewayCreateInput { + return &NullableMetalGatewayCreateInput{value: val, isSet: true} +} + +func (v NullableMetalGatewayCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetalGatewayCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_elastic_ip_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_elastic_ip_create_input.go new file mode 100644 index 00000000..0b5172d9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_elastic_ip_create_input.go @@ -0,0 +1,274 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the MetalGatewayElasticIpCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetalGatewayElasticIpCreateInput{} + +// MetalGatewayElasticIpCreateInput struct for MetalGatewayElasticIpCreateInput +type MetalGatewayElasticIpCreateInput struct { + // An IP address (or IP Address range) contained within one of the project's IP Reservations + Address string `json:"address"` + // An IP address contained within the Metal Gateways' IP Reservation range. + NextHop string `json:"next_hop"` + // Optional User-defined JSON object value. + Customdata map[string]interface{} `json:"customdata,omitempty"` + // Optional list of User-defined tags. Can be used by users to provide additional details or context regarding the purpose or usage of this resource. + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MetalGatewayElasticIpCreateInput MetalGatewayElasticIpCreateInput + +// NewMetalGatewayElasticIpCreateInput instantiates a new MetalGatewayElasticIpCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetalGatewayElasticIpCreateInput(address string, nextHop string) *MetalGatewayElasticIpCreateInput { + this := MetalGatewayElasticIpCreateInput{} + this.Address = address + this.NextHop = nextHop + return &this +} + +// NewMetalGatewayElasticIpCreateInputWithDefaults instantiates a new MetalGatewayElasticIpCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetalGatewayElasticIpCreateInputWithDefaults() *MetalGatewayElasticIpCreateInput { + this := MetalGatewayElasticIpCreateInput{} + return &this +} + +// GetAddress returns the Address field value +func (o *MetalGatewayElasticIpCreateInput) GetAddress() string { + if o == nil { + var ret string + return ret + } + + return o.Address +} + +// GetAddressOk returns a tuple with the Address field value +// and a boolean to check if the value has been set. +func (o *MetalGatewayElasticIpCreateInput) GetAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Address, true +} + +// SetAddress sets field value +func (o *MetalGatewayElasticIpCreateInput) SetAddress(v string) { + o.Address = v +} + +// GetNextHop returns the NextHop field value +func (o *MetalGatewayElasticIpCreateInput) GetNextHop() string { + if o == nil { + var ret string + return ret + } + + return o.NextHop +} + +// GetNextHopOk returns a tuple with the NextHop field value +// and a boolean to check if the value has been set. +func (o *MetalGatewayElasticIpCreateInput) GetNextHopOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextHop, true +} + +// SetNextHop sets field value +func (o *MetalGatewayElasticIpCreateInput) SetNextHop(v string) { + o.NextHop = v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *MetalGatewayElasticIpCreateInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayElasticIpCreateInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *MetalGatewayElasticIpCreateInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *MetalGatewayElasticIpCreateInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MetalGatewayElasticIpCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayElasticIpCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *MetalGatewayElasticIpCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *MetalGatewayElasticIpCreateInput) SetTags(v []string) { + o.Tags = v +} + +func (o MetalGatewayElasticIpCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetalGatewayElasticIpCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["address"] = o.Address + toSerialize["next_hop"] = o.NextHop + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MetalGatewayElasticIpCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "address", + "next_hop", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varMetalGatewayElasticIpCreateInput := _MetalGatewayElasticIpCreateInput{} + + err = json.Unmarshal(data, &varMetalGatewayElasticIpCreateInput) + + if err != nil { + return err + } + + *o = MetalGatewayElasticIpCreateInput(varMetalGatewayElasticIpCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "next_hop") + delete(additionalProperties, "customdata") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetalGatewayElasticIpCreateInput struct { + value *MetalGatewayElasticIpCreateInput + isSet bool +} + +func (v NullableMetalGatewayElasticIpCreateInput) Get() *MetalGatewayElasticIpCreateInput { + return v.value +} + +func (v *NullableMetalGatewayElasticIpCreateInput) Set(val *MetalGatewayElasticIpCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableMetalGatewayElasticIpCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableMetalGatewayElasticIpCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetalGatewayElasticIpCreateInput(val *MetalGatewayElasticIpCreateInput) *NullableMetalGatewayElasticIpCreateInput { + return &NullableMetalGatewayElasticIpCreateInput{value: val, isSet: true} +} + +func (v NullableMetalGatewayElasticIpCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetalGatewayElasticIpCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_list.go new file mode 100644 index 00000000..37ed6e97 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_list.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the MetalGatewayList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetalGatewayList{} + +// MetalGatewayList struct for MetalGatewayList +type MetalGatewayList struct { + MetalGateways []MetalGatewayListMetalGatewaysInner `json:"metal_gateways,omitempty"` + Meta *Meta `json:"meta,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MetalGatewayList MetalGatewayList + +// NewMetalGatewayList instantiates a new MetalGatewayList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetalGatewayList() *MetalGatewayList { + this := MetalGatewayList{} + return &this +} + +// NewMetalGatewayListWithDefaults instantiates a new MetalGatewayList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetalGatewayListWithDefaults() *MetalGatewayList { + this := MetalGatewayList{} + return &this +} + +// GetMetalGateways returns the MetalGateways field value if set, zero value otherwise. +func (o *MetalGatewayList) GetMetalGateways() []MetalGatewayListMetalGatewaysInner { + if o == nil || IsNil(o.MetalGateways) { + var ret []MetalGatewayListMetalGatewaysInner + return ret + } + return o.MetalGateways +} + +// GetMetalGatewaysOk returns a tuple with the MetalGateways field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayList) GetMetalGatewaysOk() ([]MetalGatewayListMetalGatewaysInner, bool) { + if o == nil || IsNil(o.MetalGateways) { + return nil, false + } + return o.MetalGateways, true +} + +// HasMetalGateways returns a boolean if a field has been set. +func (o *MetalGatewayList) HasMetalGateways() bool { + if o != nil && !IsNil(o.MetalGateways) { + return true + } + + return false +} + +// SetMetalGateways gets a reference to the given []MetalGatewayListMetalGatewaysInner and assigns it to the MetalGateways field. +func (o *MetalGatewayList) SetMetalGateways(v []MetalGatewayListMetalGatewaysInner) { + o.MetalGateways = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *MetalGatewayList) GetMeta() Meta { + if o == nil || IsNil(o.Meta) { + var ret Meta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayList) GetMetaOk() (*Meta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *MetalGatewayList) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given Meta and assigns it to the Meta field. +func (o *MetalGatewayList) SetMeta(v Meta) { + o.Meta = &v +} + +func (o MetalGatewayList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetalGatewayList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.MetalGateways) { + toSerialize["metal_gateways"] = o.MetalGateways + } + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MetalGatewayList) UnmarshalJSON(data []byte) (err error) { + varMetalGatewayList := _MetalGatewayList{} + + err = json.Unmarshal(data, &varMetalGatewayList) + + if err != nil { + return err + } + + *o = MetalGatewayList(varMetalGatewayList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "metal_gateways") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetalGatewayList struct { + value *MetalGatewayList + isSet bool +} + +func (v NullableMetalGatewayList) Get() *MetalGatewayList { + return v.value +} + +func (v *NullableMetalGatewayList) Set(val *MetalGatewayList) { + v.value = val + v.isSet = true +} + +func (v NullableMetalGatewayList) IsSet() bool { + return v.isSet +} + +func (v *NullableMetalGatewayList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetalGatewayList(val *MetalGatewayList) *NullableMetalGatewayList { + return &NullableMetalGatewayList{value: val, isSet: true} +} + +func (v NullableMetalGatewayList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetalGatewayList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_list_metal_gateways_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_list_metal_gateways_inner.go new file mode 100644 index 00000000..71b0f173 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_list_metal_gateways_inner.go @@ -0,0 +1,104 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// MetalGatewayListMetalGatewaysInner struct for MetalGatewayListMetalGatewaysInner +type MetalGatewayListMetalGatewaysInner struct { + MetalGateway *MetalGateway + VrfMetalGateway *VrfMetalGateway +} + +// Unmarshal JSON data into any of the pointers in the struct +func (dst *MetalGatewayListMetalGatewaysInner) UnmarshalJSON(data []byte) error { + var err error + // try to unmarshal JSON data into MetalGateway + err = json.Unmarshal(data, &dst.MetalGateway) + if err == nil { + jsonMetalGateway, _ := json.Marshal(dst.MetalGateway) + if string(jsonMetalGateway) == "{}" { // empty struct + dst.MetalGateway = nil + } else { + return nil // data stored in dst.MetalGateway, return on the first match + } + } else { + dst.MetalGateway = nil + } + + // try to unmarshal JSON data into VrfMetalGateway + err = json.Unmarshal(data, &dst.VrfMetalGateway) + if err == nil { + jsonVrfMetalGateway, _ := json.Marshal(dst.VrfMetalGateway) + if string(jsonVrfMetalGateway) == "{}" { // empty struct + dst.VrfMetalGateway = nil + } else { + return nil // data stored in dst.VrfMetalGateway, return on the first match + } + } else { + dst.VrfMetalGateway = nil + } + + return fmt.Errorf("data failed to match schemas in anyOf(MetalGatewayListMetalGatewaysInner)") +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src *MetalGatewayListMetalGatewaysInner) MarshalJSON() ([]byte, error) { + if src.MetalGateway != nil { + return json.Marshal(&src.MetalGateway) + } + + if src.VrfMetalGateway != nil { + return json.Marshal(&src.VrfMetalGateway) + } + + return nil, nil // no data in anyOf schemas +} + +type NullableMetalGatewayListMetalGatewaysInner struct { + value *MetalGatewayListMetalGatewaysInner + isSet bool +} + +func (v NullableMetalGatewayListMetalGatewaysInner) Get() *MetalGatewayListMetalGatewaysInner { + return v.value +} + +func (v *NullableMetalGatewayListMetalGatewaysInner) Set(val *MetalGatewayListMetalGatewaysInner) { + v.value = val + v.isSet = true +} + +func (v NullableMetalGatewayListMetalGatewaysInner) IsSet() bool { + return v.isSet +} + +func (v *NullableMetalGatewayListMetalGatewaysInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetalGatewayListMetalGatewaysInner(val *MetalGatewayListMetalGatewaysInner) *NullableMetalGatewayListMetalGatewaysInner { + return &NullableMetalGatewayListMetalGatewaysInner{value: val, isSet: true} +} + +func (v NullableMetalGatewayListMetalGatewaysInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetalGatewayListMetalGatewaysInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_lite.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_lite.go new file mode 100644 index 00000000..eaf74aee --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_lite.go @@ -0,0 +1,379 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the MetalGatewayLite type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetalGatewayLite{} + +// MetalGatewayLite struct for MetalGatewayLite +type MetalGatewayLite struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + // The gateway address with subnet CIDR value for this Metal Gateway. For example, a Metal Gateway using an IP reservation with block 10.1.2.0/27 would have a gateway address of 10.1.2.1/27. + GatewayAddress *string `json:"gateway_address,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + State *MetalGatewayState `json:"state,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // The VLAN id of the Virtual Network record associated to this Metal Gateway. + Vlan *int32 `json:"vlan,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MetalGatewayLite MetalGatewayLite + +// NewMetalGatewayLite instantiates a new MetalGatewayLite object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetalGatewayLite() *MetalGatewayLite { + this := MetalGatewayLite{} + return &this +} + +// NewMetalGatewayLiteWithDefaults instantiates a new MetalGatewayLite object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetalGatewayLiteWithDefaults() *MetalGatewayLite { + this := MetalGatewayLite{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *MetalGatewayLite) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayLite) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *MetalGatewayLite) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *MetalGatewayLite) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetGatewayAddress returns the GatewayAddress field value if set, zero value otherwise. +func (o *MetalGatewayLite) GetGatewayAddress() string { + if o == nil || IsNil(o.GatewayAddress) { + var ret string + return ret + } + return *o.GatewayAddress +} + +// GetGatewayAddressOk returns a tuple with the GatewayAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayLite) GetGatewayAddressOk() (*string, bool) { + if o == nil || IsNil(o.GatewayAddress) { + return nil, false + } + return o.GatewayAddress, true +} + +// HasGatewayAddress returns a boolean if a field has been set. +func (o *MetalGatewayLite) HasGatewayAddress() bool { + if o != nil && !IsNil(o.GatewayAddress) { + return true + } + + return false +} + +// SetGatewayAddress gets a reference to the given string and assigns it to the GatewayAddress field. +func (o *MetalGatewayLite) SetGatewayAddress(v string) { + o.GatewayAddress = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *MetalGatewayLite) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayLite) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *MetalGatewayLite) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *MetalGatewayLite) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MetalGatewayLite) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayLite) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MetalGatewayLite) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MetalGatewayLite) SetId(v string) { + o.Id = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *MetalGatewayLite) GetState() MetalGatewayState { + if o == nil || IsNil(o.State) { + var ret MetalGatewayState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayLite) GetStateOk() (*MetalGatewayState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *MetalGatewayLite) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given MetalGatewayState and assigns it to the State field. +func (o *MetalGatewayLite) SetState(v MetalGatewayState) { + o.State = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *MetalGatewayLite) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayLite) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *MetalGatewayLite) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *MetalGatewayLite) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetVlan returns the Vlan field value if set, zero value otherwise. +func (o *MetalGatewayLite) GetVlan() int32 { + if o == nil || IsNil(o.Vlan) { + var ret int32 + return ret + } + return *o.Vlan +} + +// GetVlanOk returns a tuple with the Vlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetalGatewayLite) GetVlanOk() (*int32, bool) { + if o == nil || IsNil(o.Vlan) { + return nil, false + } + return o.Vlan, true +} + +// HasVlan returns a boolean if a field has been set. +func (o *MetalGatewayLite) HasVlan() bool { + if o != nil && !IsNil(o.Vlan) { + return true + } + + return false +} + +// SetVlan gets a reference to the given int32 and assigns it to the Vlan field. +func (o *MetalGatewayLite) SetVlan(v int32) { + o.Vlan = &v +} + +func (o MetalGatewayLite) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetalGatewayLite) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.GatewayAddress) { + toSerialize["gateway_address"] = o.GatewayAddress + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Vlan) { + toSerialize["vlan"] = o.Vlan + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MetalGatewayLite) UnmarshalJSON(data []byte) (err error) { + varMetalGatewayLite := _MetalGatewayLite{} + + err = json.Unmarshal(data, &varMetalGatewayLite) + + if err != nil { + return err + } + + *o = MetalGatewayLite(varMetalGatewayLite) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "gateway_address") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "state") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "vlan") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetalGatewayLite struct { + value *MetalGatewayLite + isSet bool +} + +func (v NullableMetalGatewayLite) Get() *MetalGatewayLite { + return v.value +} + +func (v *NullableMetalGatewayLite) Set(val *MetalGatewayLite) { + v.value = val + v.isSet = true +} + +func (v NullableMetalGatewayLite) IsSet() bool { + return v.isSet +} + +func (v *NullableMetalGatewayLite) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetalGatewayLite(val *MetalGatewayLite) *NullableMetalGatewayLite { + return &NullableMetalGatewayLite{value: val, isSet: true} +} + +func (v NullableMetalGatewayLite) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetalGatewayLite) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_state.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_state.go new file mode 100644 index 00000000..dba9dc6d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metal_gateway_state.go @@ -0,0 +1,113 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// MetalGatewayState The current state of the Metal Gateway. 'Ready' indicates the gateway record has been configured, but is currently not active on the network. 'Active' indicates the gateway has been configured on the network. 'Deleting' is a temporary state used to indicate that the gateway is in the process of being un-configured from the network, after which the gateway record will be deleted. +type MetalGatewayState string + +// List of MetalGateway_state +const ( + METALGATEWAYSTATE_READY MetalGatewayState = "ready" + METALGATEWAYSTATE_ACTIVE MetalGatewayState = "active" + METALGATEWAYSTATE_DELETING MetalGatewayState = "deleting" +) + +// All allowed values of MetalGatewayState enum +var AllowedMetalGatewayStateEnumValues = []MetalGatewayState{ + "ready", + "active", + "deleting", +} + +func (v *MetalGatewayState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := MetalGatewayState(value) + for _, existing := range AllowedMetalGatewayStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid MetalGatewayState", value) +} + +// NewMetalGatewayStateFromValue returns a pointer to a valid MetalGatewayState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewMetalGatewayStateFromValue(v string) (*MetalGatewayState, error) { + ev := MetalGatewayState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for MetalGatewayState: valid values are %v", v, AllowedMetalGatewayStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v MetalGatewayState) IsValid() bool { + for _, existing := range AllowedMetalGatewayStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MetalGateway_state value +func (v MetalGatewayState) Ptr() *MetalGatewayState { + return &v +} + +type NullableMetalGatewayState struct { + value *MetalGatewayState + isSet bool +} + +func (v NullableMetalGatewayState) Get() *MetalGatewayState { + return v.value +} + +func (v *NullableMetalGatewayState) Set(val *MetalGatewayState) { + v.value = val + v.isSet = true +} + +func (v NullableMetalGatewayState) IsSet() bool { + return v.isSet +} + +func (v *NullableMetalGatewayState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetalGatewayState(val *MetalGatewayState) *NullableMetalGatewayState { + return &NullableMetalGatewayState{value: val, isSet: true} +} + +func (v NullableMetalGatewayState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetalGatewayState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro.go new file mode 100644 index 00000000..bf2e0d43 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro.go @@ -0,0 +1,265 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Metro type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Metro{} + +// Metro struct for Metro +type Metro struct { + Code *string `json:"code,omitempty"` + Country *string `json:"country,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Metro Metro + +// NewMetro instantiates a new Metro object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetro() *Metro { + this := Metro{} + return &this +} + +// NewMetroWithDefaults instantiates a new Metro object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetroWithDefaults() *Metro { + this := Metro{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *Metro) GetCode() string { + if o == nil || IsNil(o.Code) { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metro) GetCodeOk() (*string, bool) { + if o == nil || IsNil(o.Code) { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *Metro) HasCode() bool { + if o != nil && !IsNil(o.Code) { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *Metro) SetCode(v string) { + o.Code = &v +} + +// GetCountry returns the Country field value if set, zero value otherwise. +func (o *Metro) GetCountry() string { + if o == nil || IsNil(o.Country) { + var ret string + return ret + } + return *o.Country +} + +// GetCountryOk returns a tuple with the Country field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metro) GetCountryOk() (*string, bool) { + if o == nil || IsNil(o.Country) { + return nil, false + } + return o.Country, true +} + +// HasCountry returns a boolean if a field has been set. +func (o *Metro) HasCountry() bool { + if o != nil && !IsNil(o.Country) { + return true + } + + return false +} + +// SetCountry gets a reference to the given string and assigns it to the Country field. +func (o *Metro) SetCountry(v string) { + o.Country = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Metro) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metro) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Metro) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Metro) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Metro) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Metro) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Metro) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Metro) SetName(v string) { + o.Name = &v +} + +func (o Metro) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Metro) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Code) { + toSerialize["code"] = o.Code + } + if !IsNil(o.Country) { + toSerialize["country"] = o.Country + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Metro) UnmarshalJSON(data []byte) (err error) { + varMetro := _Metro{} + + err = json.Unmarshal(data, &varMetro) + + if err != nil { + return err + } + + *o = Metro(varMetro) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "country") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetro struct { + value *Metro + isSet bool +} + +func (v NullableMetro) Get() *Metro { + return v.value +} + +func (v *NullableMetro) Set(val *Metro) { + v.value = val + v.isSet = true +} + +func (v NullableMetro) IsSet() bool { + return v.isSet +} + +func (v *NullableMetro) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetro(val *Metro) *NullableMetro { + return &NullableMetro{value: val, isSet: true} +} + +func (v NullableMetro) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetro) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro_input.go new file mode 100644 index 00000000..207d765b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro_input.go @@ -0,0 +1,168 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the MetroInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetroInput{} + +// MetroInput struct for MetroInput +type MetroInput struct { + // Metro code or ID of where the instance should be provisioned in. Either metro or facility must be provided. + Metro string `json:"metro"` + AdditionalProperties map[string]interface{} +} + +type _MetroInput MetroInput + +// NewMetroInput instantiates a new MetroInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetroInput(metro string) *MetroInput { + this := MetroInput{} + this.Metro = metro + return &this +} + +// NewMetroInputWithDefaults instantiates a new MetroInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetroInputWithDefaults() *MetroInput { + this := MetroInput{} + return &this +} + +// GetMetro returns the Metro field value +func (o *MetroInput) GetMetro() string { + if o == nil { + var ret string + return ret + } + + return o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value +// and a boolean to check if the value has been set. +func (o *MetroInput) GetMetroOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metro, true +} + +// SetMetro sets field value +func (o *MetroInput) SetMetro(v string) { + o.Metro = v +} + +func (o MetroInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetroInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["metro"] = o.Metro + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MetroInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "metro", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varMetroInput := _MetroInput{} + + err = json.Unmarshal(data, &varMetroInput) + + if err != nil { + return err + } + + *o = MetroInput(varMetroInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "metro") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetroInput struct { + value *MetroInput + isSet bool +} + +func (v NullableMetroInput) Get() *MetroInput { + return v.value +} + +func (v *NullableMetroInput) Set(val *MetroInput) { + v.value = val + v.isSet = true +} + +func (v NullableMetroInput) IsSet() bool { + return v.isSet +} + +func (v *NullableMetroInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetroInput(val *MetroInput) *NullableMetroInput { + return &NullableMetroInput{value: val, isSet: true} +} + +func (v NullableMetroInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetroInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro_list.go new file mode 100644 index 00000000..d5f23695 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_metro_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the MetroList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetroList{} + +// MetroList struct for MetroList +type MetroList struct { + Metros []Metro `json:"metros,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MetroList MetroList + +// NewMetroList instantiates a new MetroList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetroList() *MetroList { + this := MetroList{} + return &this +} + +// NewMetroListWithDefaults instantiates a new MetroList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetroListWithDefaults() *MetroList { + this := MetroList{} + return &this +} + +// GetMetros returns the Metros field value if set, zero value otherwise. +func (o *MetroList) GetMetros() []Metro { + if o == nil || IsNil(o.Metros) { + var ret []Metro + return ret + } + return o.Metros +} + +// GetMetrosOk returns a tuple with the Metros field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetroList) GetMetrosOk() ([]Metro, bool) { + if o == nil || IsNil(o.Metros) { + return nil, false + } + return o.Metros, true +} + +// HasMetros returns a boolean if a field has been set. +func (o *MetroList) HasMetros() bool { + if o != nil && !IsNil(o.Metros) { + return true + } + + return false +} + +// SetMetros gets a reference to the given []Metro and assigns it to the Metros field. +func (o *MetroList) SetMetros(v []Metro) { + o.Metros = v +} + +func (o MetroList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetroList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Metros) { + toSerialize["metros"] = o.Metros + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MetroList) UnmarshalJSON(data []byte) (err error) { + varMetroList := _MetroList{} + + err = json.Unmarshal(data, &varMetroList) + + if err != nil { + return err + } + + *o = MetroList(varMetroList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "metros") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetroList struct { + value *MetroList + isSet bool +} + +func (v NullableMetroList) Get() *MetroList { + return v.value +} + +func (v *NullableMetroList) Set(val *MetroList) { + v.value = val + v.isSet = true +} + +func (v NullableMetroList) IsSet() bool { + return v.isSet +} + +func (v *NullableMetroList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetroList(val *MetroList) *NullableMetroList { + return &NullableMetroList{value: val, isSet: true} +} + +func (v NullableMetroList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetroList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_mount.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_mount.go new file mode 100644 index 00000000..f1581ba9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_mount.go @@ -0,0 +1,265 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Mount type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Mount{} + +// Mount struct for Mount +type Mount struct { + Device *string `json:"device,omitempty"` + Format *string `json:"format,omitempty"` + Point *string `json:"point,omitempty"` + Options []string `json:"options,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Mount Mount + +// NewMount instantiates a new Mount object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMount() *Mount { + this := Mount{} + return &this +} + +// NewMountWithDefaults instantiates a new Mount object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMountWithDefaults() *Mount { + this := Mount{} + return &this +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *Mount) GetDevice() string { + if o == nil || IsNil(o.Device) { + var ret string + return ret + } + return *o.Device +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Mount) GetDeviceOk() (*string, bool) { + if o == nil || IsNil(o.Device) { + return nil, false + } + return o.Device, true +} + +// HasDevice returns a boolean if a field has been set. +func (o *Mount) HasDevice() bool { + if o != nil && !IsNil(o.Device) { + return true + } + + return false +} + +// SetDevice gets a reference to the given string and assigns it to the Device field. +func (o *Mount) SetDevice(v string) { + o.Device = &v +} + +// GetFormat returns the Format field value if set, zero value otherwise. +func (o *Mount) GetFormat() string { + if o == nil || IsNil(o.Format) { + var ret string + return ret + } + return *o.Format +} + +// GetFormatOk returns a tuple with the Format field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Mount) GetFormatOk() (*string, bool) { + if o == nil || IsNil(o.Format) { + return nil, false + } + return o.Format, true +} + +// HasFormat returns a boolean if a field has been set. +func (o *Mount) HasFormat() bool { + if o != nil && !IsNil(o.Format) { + return true + } + + return false +} + +// SetFormat gets a reference to the given string and assigns it to the Format field. +func (o *Mount) SetFormat(v string) { + o.Format = &v +} + +// GetPoint returns the Point field value if set, zero value otherwise. +func (o *Mount) GetPoint() string { + if o == nil || IsNil(o.Point) { + var ret string + return ret + } + return *o.Point +} + +// GetPointOk returns a tuple with the Point field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Mount) GetPointOk() (*string, bool) { + if o == nil || IsNil(o.Point) { + return nil, false + } + return o.Point, true +} + +// HasPoint returns a boolean if a field has been set. +func (o *Mount) HasPoint() bool { + if o != nil && !IsNil(o.Point) { + return true + } + + return false +} + +// SetPoint gets a reference to the given string and assigns it to the Point field. +func (o *Mount) SetPoint(v string) { + o.Point = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *Mount) GetOptions() []string { + if o == nil || IsNil(o.Options) { + var ret []string + return ret + } + return o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Mount) GetOptionsOk() ([]string, bool) { + if o == nil || IsNil(o.Options) { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *Mount) HasOptions() bool { + if o != nil && !IsNil(o.Options) { + return true + } + + return false +} + +// SetOptions gets a reference to the given []string and assigns it to the Options field. +func (o *Mount) SetOptions(v []string) { + o.Options = v +} + +func (o Mount) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Mount) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Device) { + toSerialize["device"] = o.Device + } + if !IsNil(o.Format) { + toSerialize["format"] = o.Format + } + if !IsNil(o.Point) { + toSerialize["point"] = o.Point + } + if !IsNil(o.Options) { + toSerialize["options"] = o.Options + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Mount) UnmarshalJSON(data []byte) (err error) { + varMount := _Mount{} + + err = json.Unmarshal(data, &varMount) + + if err != nil { + return err + } + + *o = Mount(varMount) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "device") + delete(additionalProperties, "format") + delete(additionalProperties, "point") + delete(additionalProperties, "options") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMount struct { + value *Mount + isSet bool +} + +func (v NullableMount) Get() *Mount { + return v.value +} + +func (v *NullableMount) Set(val *Mount) { + v.value = val + v.isSet = true +} + +func (v NullableMount) IsSet() bool { + return v.isSet +} + +func (v *NullableMount) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMount(val *Mount) *NullableMount { + return &NullableMount{value: val, isSet: true} +} + +func (v NullableMount) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMount) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_move_hardware_reservation_request.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_move_hardware_reservation_request.go new file mode 100644 index 00000000..fb6fbc77 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_move_hardware_reservation_request.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the MoveHardwareReservationRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MoveHardwareReservationRequest{} + +// MoveHardwareReservationRequest struct for MoveHardwareReservationRequest +type MoveHardwareReservationRequest struct { + ProjectId *string `json:"project_id,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MoveHardwareReservationRequest MoveHardwareReservationRequest + +// NewMoveHardwareReservationRequest instantiates a new MoveHardwareReservationRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMoveHardwareReservationRequest() *MoveHardwareReservationRequest { + this := MoveHardwareReservationRequest{} + return &this +} + +// NewMoveHardwareReservationRequestWithDefaults instantiates a new MoveHardwareReservationRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMoveHardwareReservationRequestWithDefaults() *MoveHardwareReservationRequest { + this := MoveHardwareReservationRequest{} + return &this +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *MoveHardwareReservationRequest) GetProjectId() string { + if o == nil || IsNil(o.ProjectId) { + var ret string + return ret + } + return *o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MoveHardwareReservationRequest) GetProjectIdOk() (*string, bool) { + if o == nil || IsNil(o.ProjectId) { + return nil, false + } + return o.ProjectId, true +} + +// HasProjectId returns a boolean if a field has been set. +func (o *MoveHardwareReservationRequest) HasProjectId() bool { + if o != nil && !IsNil(o.ProjectId) { + return true + } + + return false +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *MoveHardwareReservationRequest) SetProjectId(v string) { + o.ProjectId = &v +} + +func (o MoveHardwareReservationRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MoveHardwareReservationRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ProjectId) { + toSerialize["project_id"] = o.ProjectId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MoveHardwareReservationRequest) UnmarshalJSON(data []byte) (err error) { + varMoveHardwareReservationRequest := _MoveHardwareReservationRequest{} + + err = json.Unmarshal(data, &varMoveHardwareReservationRequest) + + if err != nil { + return err + } + + *o = MoveHardwareReservationRequest(varMoveHardwareReservationRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "project_id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMoveHardwareReservationRequest struct { + value *MoveHardwareReservationRequest + isSet bool +} + +func (v NullableMoveHardwareReservationRequest) Get() *MoveHardwareReservationRequest { + return v.value +} + +func (v *NullableMoveHardwareReservationRequest) Set(val *MoveHardwareReservationRequest) { + v.value = val + v.isSet = true +} + +func (v NullableMoveHardwareReservationRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableMoveHardwareReservationRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMoveHardwareReservationRequest(val *MoveHardwareReservationRequest) *NullableMoveHardwareReservationRequest { + return &NullableMoveHardwareReservationRequest{value: val, isSet: true} +} + +func (v NullableMoveHardwareReservationRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMoveHardwareReservationRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_new_password.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_new_password.go new file mode 100644 index 00000000..22a2a94c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_new_password.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the NewPassword type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NewPassword{} + +// NewPassword struct for NewPassword +type NewPassword struct { + NewPassword *string `json:"new_password,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _NewPassword NewPassword + +// NewNewPassword instantiates a new NewPassword object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNewPassword() *NewPassword { + this := NewPassword{} + return &this +} + +// NewNewPasswordWithDefaults instantiates a new NewPassword object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNewPasswordWithDefaults() *NewPassword { + this := NewPassword{} + return &this +} + +// GetNewPassword returns the NewPassword field value if set, zero value otherwise. +func (o *NewPassword) GetNewPassword() string { + if o == nil || IsNil(o.NewPassword) { + var ret string + return ret + } + return *o.NewPassword +} + +// GetNewPasswordOk returns a tuple with the NewPassword field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NewPassword) GetNewPasswordOk() (*string, bool) { + if o == nil || IsNil(o.NewPassword) { + return nil, false + } + return o.NewPassword, true +} + +// HasNewPassword returns a boolean if a field has been set. +func (o *NewPassword) HasNewPassword() bool { + if o != nil && !IsNil(o.NewPassword) { + return true + } + + return false +} + +// SetNewPassword gets a reference to the given string and assigns it to the NewPassword field. +func (o *NewPassword) SetNewPassword(v string) { + o.NewPassword = &v +} + +func (o NewPassword) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NewPassword) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NewPassword) { + toSerialize["new_password"] = o.NewPassword + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *NewPassword) UnmarshalJSON(data []byte) (err error) { + varNewPassword := _NewPassword{} + + err = json.Unmarshal(data, &varNewPassword) + + if err != nil { + return err + } + + *o = NewPassword(varNewPassword) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "new_password") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNewPassword struct { + value *NewPassword + isSet bool +} + +func (v NullableNewPassword) Get() *NewPassword { + return v.value +} + +func (v *NullableNewPassword) Set(val *NewPassword) { + v.value = val + v.isSet = true +} + +func (v NullableNewPassword) IsSet() bool { + return v.isSet +} + +func (v *NullableNewPassword) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNewPassword(val *NewPassword) *NullableNewPassword { + return &NullableNewPassword{value: val, isSet: true} +} + +func (v NullableNewPassword) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNewPassword) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_operating_system.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_operating_system.go new file mode 100644 index 00000000..3a348651 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_operating_system.go @@ -0,0 +1,528 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the OperatingSystem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OperatingSystem{} + +// OperatingSystem struct for OperatingSystem +type OperatingSystem struct { + Distro *string `json:"distro,omitempty"` + DistroLabel *string `json:"distro_label,omitempty"` + Id *string `json:"id,omitempty"` + // Licenced OS is priced according to pricing property + Licensed *bool `json:"licensed,omitempty"` + Name *string `json:"name,omitempty"` + // Servers can be already preinstalled with OS in order to shorten provision time. + Preinstallable *bool `json:"preinstallable,omitempty"` + // This object contains price per time unit and optional multiplier value if licence price depends on hardware plan or components (e.g. number of cores) + Pricing map[string]interface{} `json:"pricing,omitempty"` + ProvisionableOn []string `json:"provisionable_on,omitempty"` + Slug *string `json:"slug,omitempty"` + Version *string `json:"version,omitempty"` + // Default operating system for the distro. + DefaultOperatingSystem *bool `json:"default_operating_system,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _OperatingSystem OperatingSystem + +// NewOperatingSystem instantiates a new OperatingSystem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOperatingSystem() *OperatingSystem { + this := OperatingSystem{} + return &this +} + +// NewOperatingSystemWithDefaults instantiates a new OperatingSystem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOperatingSystemWithDefaults() *OperatingSystem { + this := OperatingSystem{} + return &this +} + +// GetDistro returns the Distro field value if set, zero value otherwise. +func (o *OperatingSystem) GetDistro() string { + if o == nil || IsNil(o.Distro) { + var ret string + return ret + } + return *o.Distro +} + +// GetDistroOk returns a tuple with the Distro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystem) GetDistroOk() (*string, bool) { + if o == nil || IsNil(o.Distro) { + return nil, false + } + return o.Distro, true +} + +// HasDistro returns a boolean if a field has been set. +func (o *OperatingSystem) HasDistro() bool { + if o != nil && !IsNil(o.Distro) { + return true + } + + return false +} + +// SetDistro gets a reference to the given string and assigns it to the Distro field. +func (o *OperatingSystem) SetDistro(v string) { + o.Distro = &v +} + +// GetDistroLabel returns the DistroLabel field value if set, zero value otherwise. +func (o *OperatingSystem) GetDistroLabel() string { + if o == nil || IsNil(o.DistroLabel) { + var ret string + return ret + } + return *o.DistroLabel +} + +// GetDistroLabelOk returns a tuple with the DistroLabel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystem) GetDistroLabelOk() (*string, bool) { + if o == nil || IsNil(o.DistroLabel) { + return nil, false + } + return o.DistroLabel, true +} + +// HasDistroLabel returns a boolean if a field has been set. +func (o *OperatingSystem) HasDistroLabel() bool { + if o != nil && !IsNil(o.DistroLabel) { + return true + } + + return false +} + +// SetDistroLabel gets a reference to the given string and assigns it to the DistroLabel field. +func (o *OperatingSystem) SetDistroLabel(v string) { + o.DistroLabel = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *OperatingSystem) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystem) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *OperatingSystem) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *OperatingSystem) SetId(v string) { + o.Id = &v +} + +// GetLicensed returns the Licensed field value if set, zero value otherwise. +func (o *OperatingSystem) GetLicensed() bool { + if o == nil || IsNil(o.Licensed) { + var ret bool + return ret + } + return *o.Licensed +} + +// GetLicensedOk returns a tuple with the Licensed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystem) GetLicensedOk() (*bool, bool) { + if o == nil || IsNil(o.Licensed) { + return nil, false + } + return o.Licensed, true +} + +// HasLicensed returns a boolean if a field has been set. +func (o *OperatingSystem) HasLicensed() bool { + if o != nil && !IsNil(o.Licensed) { + return true + } + + return false +} + +// SetLicensed gets a reference to the given bool and assigns it to the Licensed field. +func (o *OperatingSystem) SetLicensed(v bool) { + o.Licensed = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *OperatingSystem) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystem) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *OperatingSystem) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *OperatingSystem) SetName(v string) { + o.Name = &v +} + +// GetPreinstallable returns the Preinstallable field value if set, zero value otherwise. +func (o *OperatingSystem) GetPreinstallable() bool { + if o == nil || IsNil(o.Preinstallable) { + var ret bool + return ret + } + return *o.Preinstallable +} + +// GetPreinstallableOk returns a tuple with the Preinstallable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystem) GetPreinstallableOk() (*bool, bool) { + if o == nil || IsNil(o.Preinstallable) { + return nil, false + } + return o.Preinstallable, true +} + +// HasPreinstallable returns a boolean if a field has been set. +func (o *OperatingSystem) HasPreinstallable() bool { + if o != nil && !IsNil(o.Preinstallable) { + return true + } + + return false +} + +// SetPreinstallable gets a reference to the given bool and assigns it to the Preinstallable field. +func (o *OperatingSystem) SetPreinstallable(v bool) { + o.Preinstallable = &v +} + +// GetPricing returns the Pricing field value if set, zero value otherwise. +func (o *OperatingSystem) GetPricing() map[string]interface{} { + if o == nil || IsNil(o.Pricing) { + var ret map[string]interface{} + return ret + } + return o.Pricing +} + +// GetPricingOk returns a tuple with the Pricing field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystem) GetPricingOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Pricing) { + return map[string]interface{}{}, false + } + return o.Pricing, true +} + +// HasPricing returns a boolean if a field has been set. +func (o *OperatingSystem) HasPricing() bool { + if o != nil && !IsNil(o.Pricing) { + return true + } + + return false +} + +// SetPricing gets a reference to the given map[string]interface{} and assigns it to the Pricing field. +func (o *OperatingSystem) SetPricing(v map[string]interface{}) { + o.Pricing = v +} + +// GetProvisionableOn returns the ProvisionableOn field value if set, zero value otherwise. +func (o *OperatingSystem) GetProvisionableOn() []string { + if o == nil || IsNil(o.ProvisionableOn) { + var ret []string + return ret + } + return o.ProvisionableOn +} + +// GetProvisionableOnOk returns a tuple with the ProvisionableOn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystem) GetProvisionableOnOk() ([]string, bool) { + if o == nil || IsNil(o.ProvisionableOn) { + return nil, false + } + return o.ProvisionableOn, true +} + +// HasProvisionableOn returns a boolean if a field has been set. +func (o *OperatingSystem) HasProvisionableOn() bool { + if o != nil && !IsNil(o.ProvisionableOn) { + return true + } + + return false +} + +// SetProvisionableOn gets a reference to the given []string and assigns it to the ProvisionableOn field. +func (o *OperatingSystem) SetProvisionableOn(v []string) { + o.ProvisionableOn = v +} + +// GetSlug returns the Slug field value if set, zero value otherwise. +func (o *OperatingSystem) GetSlug() string { + if o == nil || IsNil(o.Slug) { + var ret string + return ret + } + return *o.Slug +} + +// GetSlugOk returns a tuple with the Slug field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystem) GetSlugOk() (*string, bool) { + if o == nil || IsNil(o.Slug) { + return nil, false + } + return o.Slug, true +} + +// HasSlug returns a boolean if a field has been set. +func (o *OperatingSystem) HasSlug() bool { + if o != nil && !IsNil(o.Slug) { + return true + } + + return false +} + +// SetSlug gets a reference to the given string and assigns it to the Slug field. +func (o *OperatingSystem) SetSlug(v string) { + o.Slug = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *OperatingSystem) GetVersion() string { + if o == nil || IsNil(o.Version) { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystem) GetVersionOk() (*string, bool) { + if o == nil || IsNil(o.Version) { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *OperatingSystem) HasVersion() bool { + if o != nil && !IsNil(o.Version) { + return true + } + + return false +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *OperatingSystem) SetVersion(v string) { + o.Version = &v +} + +// GetDefaultOperatingSystem returns the DefaultOperatingSystem field value if set, zero value otherwise. +func (o *OperatingSystem) GetDefaultOperatingSystem() bool { + if o == nil || IsNil(o.DefaultOperatingSystem) { + var ret bool + return ret + } + return *o.DefaultOperatingSystem +} + +// GetDefaultOperatingSystemOk returns a tuple with the DefaultOperatingSystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystem) GetDefaultOperatingSystemOk() (*bool, bool) { + if o == nil || IsNil(o.DefaultOperatingSystem) { + return nil, false + } + return o.DefaultOperatingSystem, true +} + +// HasDefaultOperatingSystem returns a boolean if a field has been set. +func (o *OperatingSystem) HasDefaultOperatingSystem() bool { + if o != nil && !IsNil(o.DefaultOperatingSystem) { + return true + } + + return false +} + +// SetDefaultOperatingSystem gets a reference to the given bool and assigns it to the DefaultOperatingSystem field. +func (o *OperatingSystem) SetDefaultOperatingSystem(v bool) { + o.DefaultOperatingSystem = &v +} + +func (o OperatingSystem) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OperatingSystem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Distro) { + toSerialize["distro"] = o.Distro + } + if !IsNil(o.DistroLabel) { + toSerialize["distro_label"] = o.DistroLabel + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Licensed) { + toSerialize["licensed"] = o.Licensed + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Preinstallable) { + toSerialize["preinstallable"] = o.Preinstallable + } + if !IsNil(o.Pricing) { + toSerialize["pricing"] = o.Pricing + } + if !IsNil(o.ProvisionableOn) { + toSerialize["provisionable_on"] = o.ProvisionableOn + } + if !IsNil(o.Slug) { + toSerialize["slug"] = o.Slug + } + if !IsNil(o.Version) { + toSerialize["version"] = o.Version + } + if !IsNil(o.DefaultOperatingSystem) { + toSerialize["default_operating_system"] = o.DefaultOperatingSystem + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *OperatingSystem) UnmarshalJSON(data []byte) (err error) { + varOperatingSystem := _OperatingSystem{} + + err = json.Unmarshal(data, &varOperatingSystem) + + if err != nil { + return err + } + + *o = OperatingSystem(varOperatingSystem) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "distro") + delete(additionalProperties, "distro_label") + delete(additionalProperties, "id") + delete(additionalProperties, "licensed") + delete(additionalProperties, "name") + delete(additionalProperties, "preinstallable") + delete(additionalProperties, "pricing") + delete(additionalProperties, "provisionable_on") + delete(additionalProperties, "slug") + delete(additionalProperties, "version") + delete(additionalProperties, "default_operating_system") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOperatingSystem struct { + value *OperatingSystem + isSet bool +} + +func (v NullableOperatingSystem) Get() *OperatingSystem { + return v.value +} + +func (v *NullableOperatingSystem) Set(val *OperatingSystem) { + v.value = val + v.isSet = true +} + +func (v NullableOperatingSystem) IsSet() bool { + return v.isSet +} + +func (v *NullableOperatingSystem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOperatingSystem(val *OperatingSystem) *NullableOperatingSystem { + return &NullableOperatingSystem{value: val, isSet: true} +} + +func (v NullableOperatingSystem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOperatingSystem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_operating_system_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_operating_system_list.go new file mode 100644 index 00000000..e4a8ef45 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_operating_system_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the OperatingSystemList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OperatingSystemList{} + +// OperatingSystemList struct for OperatingSystemList +type OperatingSystemList struct { + OperatingSystems []OperatingSystem `json:"operating_systems,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _OperatingSystemList OperatingSystemList + +// NewOperatingSystemList instantiates a new OperatingSystemList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOperatingSystemList() *OperatingSystemList { + this := OperatingSystemList{} + return &this +} + +// NewOperatingSystemListWithDefaults instantiates a new OperatingSystemList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOperatingSystemListWithDefaults() *OperatingSystemList { + this := OperatingSystemList{} + return &this +} + +// GetOperatingSystems returns the OperatingSystems field value if set, zero value otherwise. +func (o *OperatingSystemList) GetOperatingSystems() []OperatingSystem { + if o == nil || IsNil(o.OperatingSystems) { + var ret []OperatingSystem + return ret + } + return o.OperatingSystems +} + +// GetOperatingSystemsOk returns a tuple with the OperatingSystems field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OperatingSystemList) GetOperatingSystemsOk() ([]OperatingSystem, bool) { + if o == nil || IsNil(o.OperatingSystems) { + return nil, false + } + return o.OperatingSystems, true +} + +// HasOperatingSystems returns a boolean if a field has been set. +func (o *OperatingSystemList) HasOperatingSystems() bool { + if o != nil && !IsNil(o.OperatingSystems) { + return true + } + + return false +} + +// SetOperatingSystems gets a reference to the given []OperatingSystem and assigns it to the OperatingSystems field. +func (o *OperatingSystemList) SetOperatingSystems(v []OperatingSystem) { + o.OperatingSystems = v +} + +func (o OperatingSystemList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OperatingSystemList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.OperatingSystems) { + toSerialize["operating_systems"] = o.OperatingSystems + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *OperatingSystemList) UnmarshalJSON(data []byte) (err error) { + varOperatingSystemList := _OperatingSystemList{} + + err = json.Unmarshal(data, &varOperatingSystemList) + + if err != nil { + return err + } + + *o = OperatingSystemList(varOperatingSystemList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "operating_systems") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOperatingSystemList struct { + value *OperatingSystemList + isSet bool +} + +func (v NullableOperatingSystemList) Get() *OperatingSystemList { + return v.value +} + +func (v *NullableOperatingSystemList) Set(val *OperatingSystemList) { + v.value = val + v.isSet = true +} + +func (v NullableOperatingSystemList) IsSet() bool { + return v.isSet +} + +func (v *NullableOperatingSystemList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOperatingSystemList(val *OperatingSystemList) *NullableOperatingSystemList { + return &NullableOperatingSystemList{value: val, isSet: true} +} + +func (v NullableOperatingSystemList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOperatingSystemList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization.go new file mode 100644 index 00000000..9231cecf --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization.go @@ -0,0 +1,748 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the Organization type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Organization{} + +// Organization struct for Organization +type Organization struct { + Address *Address `json:"address,omitempty"` + BillingAddress *Address `json:"billing_address,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + CreditAmount *float32 `json:"credit_amount,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Description *string `json:"description,omitempty"` + // Force to all members to have enabled the two factor authentication after that date, unless the value is null + Enforce2faAt *time.Time `json:"enforce_2fa_at,omitempty"` + Id *string `json:"id,omitempty"` + Logo *string `json:"logo,omitempty"` + Members []Href `json:"members,omitempty"` + Memberships []Href `json:"memberships,omitempty"` + Name *string `json:"name,omitempty"` + Projects []Href `json:"projects,omitempty"` + Terms *int32 `json:"terms,omitempty"` + Twitter *string `json:"twitter,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + Website *string `json:"website,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Organization Organization + +// NewOrganization instantiates a new Organization object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOrganization() *Organization { + this := Organization{} + return &this +} + +// NewOrganizationWithDefaults instantiates a new Organization object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOrganizationWithDefaults() *Organization { + this := Organization{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *Organization) GetAddress() Address { + if o == nil || IsNil(o.Address) { + var ret Address + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetAddressOk() (*Address, bool) { + if o == nil || IsNil(o.Address) { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *Organization) HasAddress() bool { + if o != nil && !IsNil(o.Address) { + return true + } + + return false +} + +// SetAddress gets a reference to the given Address and assigns it to the Address field. +func (o *Organization) SetAddress(v Address) { + o.Address = &v +} + +// GetBillingAddress returns the BillingAddress field value if set, zero value otherwise. +func (o *Organization) GetBillingAddress() Address { + if o == nil || IsNil(o.BillingAddress) { + var ret Address + return ret + } + return *o.BillingAddress +} + +// GetBillingAddressOk returns a tuple with the BillingAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetBillingAddressOk() (*Address, bool) { + if o == nil || IsNil(o.BillingAddress) { + return nil, false + } + return o.BillingAddress, true +} + +// HasBillingAddress returns a boolean if a field has been set. +func (o *Organization) HasBillingAddress() bool { + if o != nil && !IsNil(o.BillingAddress) { + return true + } + + return false +} + +// SetBillingAddress gets a reference to the given Address and assigns it to the BillingAddress field. +func (o *Organization) SetBillingAddress(v Address) { + o.BillingAddress = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Organization) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Organization) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Organization) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCreditAmount returns the CreditAmount field value if set, zero value otherwise. +func (o *Organization) GetCreditAmount() float32 { + if o == nil || IsNil(o.CreditAmount) { + var ret float32 + return ret + } + return *o.CreditAmount +} + +// GetCreditAmountOk returns a tuple with the CreditAmount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetCreditAmountOk() (*float32, bool) { + if o == nil || IsNil(o.CreditAmount) { + return nil, false + } + return o.CreditAmount, true +} + +// HasCreditAmount returns a boolean if a field has been set. +func (o *Organization) HasCreditAmount() bool { + if o != nil && !IsNil(o.CreditAmount) { + return true + } + + return false +} + +// SetCreditAmount gets a reference to the given float32 and assigns it to the CreditAmount field. +func (o *Organization) SetCreditAmount(v float32) { + o.CreditAmount = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *Organization) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *Organization) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *Organization) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Organization) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Organization) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Organization) SetDescription(v string) { + o.Description = &v +} + +// GetEnforce2faAt returns the Enforce2faAt field value if set, zero value otherwise. +func (o *Organization) GetEnforce2faAt() time.Time { + if o == nil || IsNil(o.Enforce2faAt) { + var ret time.Time + return ret + } + return *o.Enforce2faAt +} + +// GetEnforce2faAtOk returns a tuple with the Enforce2faAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetEnforce2faAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.Enforce2faAt) { + return nil, false + } + return o.Enforce2faAt, true +} + +// HasEnforce2faAt returns a boolean if a field has been set. +func (o *Organization) HasEnforce2faAt() bool { + if o != nil && !IsNil(o.Enforce2faAt) { + return true + } + + return false +} + +// SetEnforce2faAt gets a reference to the given time.Time and assigns it to the Enforce2faAt field. +func (o *Organization) SetEnforce2faAt(v time.Time) { + o.Enforce2faAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Organization) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Organization) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Organization) SetId(v string) { + o.Id = &v +} + +// GetLogo returns the Logo field value if set, zero value otherwise. +func (o *Organization) GetLogo() string { + if o == nil || IsNil(o.Logo) { + var ret string + return ret + } + return *o.Logo +} + +// GetLogoOk returns a tuple with the Logo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetLogoOk() (*string, bool) { + if o == nil || IsNil(o.Logo) { + return nil, false + } + return o.Logo, true +} + +// HasLogo returns a boolean if a field has been set. +func (o *Organization) HasLogo() bool { + if o != nil && !IsNil(o.Logo) { + return true + } + + return false +} + +// SetLogo gets a reference to the given string and assigns it to the Logo field. +func (o *Organization) SetLogo(v string) { + o.Logo = &v +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *Organization) GetMembers() []Href { + if o == nil || IsNil(o.Members) { + var ret []Href + return ret + } + return o.Members +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetMembersOk() ([]Href, bool) { + if o == nil || IsNil(o.Members) { + return nil, false + } + return o.Members, true +} + +// HasMembers returns a boolean if a field has been set. +func (o *Organization) HasMembers() bool { + if o != nil && !IsNil(o.Members) { + return true + } + + return false +} + +// SetMembers gets a reference to the given []Href and assigns it to the Members field. +func (o *Organization) SetMembers(v []Href) { + o.Members = v +} + +// GetMemberships returns the Memberships field value if set, zero value otherwise. +func (o *Organization) GetMemberships() []Href { + if o == nil || IsNil(o.Memberships) { + var ret []Href + return ret + } + return o.Memberships +} + +// GetMembershipsOk returns a tuple with the Memberships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetMembershipsOk() ([]Href, bool) { + if o == nil || IsNil(o.Memberships) { + return nil, false + } + return o.Memberships, true +} + +// HasMemberships returns a boolean if a field has been set. +func (o *Organization) HasMemberships() bool { + if o != nil && !IsNil(o.Memberships) { + return true + } + + return false +} + +// SetMemberships gets a reference to the given []Href and assigns it to the Memberships field. +func (o *Organization) SetMemberships(v []Href) { + o.Memberships = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Organization) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Organization) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Organization) SetName(v string) { + o.Name = &v +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *Organization) GetProjects() []Href { + if o == nil || IsNil(o.Projects) { + var ret []Href + return ret + } + return o.Projects +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetProjectsOk() ([]Href, bool) { + if o == nil || IsNil(o.Projects) { + return nil, false + } + return o.Projects, true +} + +// HasProjects returns a boolean if a field has been set. +func (o *Organization) HasProjects() bool { + if o != nil && !IsNil(o.Projects) { + return true + } + + return false +} + +// SetProjects gets a reference to the given []Href and assigns it to the Projects field. +func (o *Organization) SetProjects(v []Href) { + o.Projects = v +} + +// GetTerms returns the Terms field value if set, zero value otherwise. +func (o *Organization) GetTerms() int32 { + if o == nil || IsNil(o.Terms) { + var ret int32 + return ret + } + return *o.Terms +} + +// GetTermsOk returns a tuple with the Terms field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetTermsOk() (*int32, bool) { + if o == nil || IsNil(o.Terms) { + return nil, false + } + return o.Terms, true +} + +// HasTerms returns a boolean if a field has been set. +func (o *Organization) HasTerms() bool { + if o != nil && !IsNil(o.Terms) { + return true + } + + return false +} + +// SetTerms gets a reference to the given int32 and assigns it to the Terms field. +func (o *Organization) SetTerms(v int32) { + o.Terms = &v +} + +// GetTwitter returns the Twitter field value if set, zero value otherwise. +func (o *Organization) GetTwitter() string { + if o == nil || IsNil(o.Twitter) { + var ret string + return ret + } + return *o.Twitter +} + +// GetTwitterOk returns a tuple with the Twitter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetTwitterOk() (*string, bool) { + if o == nil || IsNil(o.Twitter) { + return nil, false + } + return o.Twitter, true +} + +// HasTwitter returns a boolean if a field has been set. +func (o *Organization) HasTwitter() bool { + if o != nil && !IsNil(o.Twitter) { + return true + } + + return false +} + +// SetTwitter gets a reference to the given string and assigns it to the Twitter field. +func (o *Organization) SetTwitter(v string) { + o.Twitter = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Organization) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Organization) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Organization) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetWebsite returns the Website field value if set, zero value otherwise. +func (o *Organization) GetWebsite() string { + if o == nil || IsNil(o.Website) { + var ret string + return ret + } + return *o.Website +} + +// GetWebsiteOk returns a tuple with the Website field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetWebsiteOk() (*string, bool) { + if o == nil || IsNil(o.Website) { + return nil, false + } + return o.Website, true +} + +// HasWebsite returns a boolean if a field has been set. +func (o *Organization) HasWebsite() bool { + if o != nil && !IsNil(o.Website) { + return true + } + + return false +} + +// SetWebsite gets a reference to the given string and assigns it to the Website field. +func (o *Organization) SetWebsite(v string) { + o.Website = &v +} + +func (o Organization) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Organization) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Address) { + toSerialize["address"] = o.Address + } + if !IsNil(o.BillingAddress) { + toSerialize["billing_address"] = o.BillingAddress + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.CreditAmount) { + toSerialize["credit_amount"] = o.CreditAmount + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Enforce2faAt) { + toSerialize["enforce_2fa_at"] = o.Enforce2faAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Logo) { + toSerialize["logo"] = o.Logo + } + if !IsNil(o.Members) { + toSerialize["members"] = o.Members + } + if !IsNil(o.Memberships) { + toSerialize["memberships"] = o.Memberships + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Projects) { + toSerialize["projects"] = o.Projects + } + if !IsNil(o.Terms) { + toSerialize["terms"] = o.Terms + } + if !IsNil(o.Twitter) { + toSerialize["twitter"] = o.Twitter + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Website) { + toSerialize["website"] = o.Website + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Organization) UnmarshalJSON(data []byte) (err error) { + varOrganization := _Organization{} + + err = json.Unmarshal(data, &varOrganization) + + if err != nil { + return err + } + + *o = Organization(varOrganization) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "billing_address") + delete(additionalProperties, "created_at") + delete(additionalProperties, "credit_amount") + delete(additionalProperties, "customdata") + delete(additionalProperties, "description") + delete(additionalProperties, "enforce_2fa_at") + delete(additionalProperties, "id") + delete(additionalProperties, "logo") + delete(additionalProperties, "members") + delete(additionalProperties, "memberships") + delete(additionalProperties, "name") + delete(additionalProperties, "projects") + delete(additionalProperties, "terms") + delete(additionalProperties, "twitter") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "website") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOrganization struct { + value *Organization + isSet bool +} + +func (v NullableOrganization) Get() *Organization { + return v.value +} + +func (v *NullableOrganization) Set(val *Organization) { + v.value = val + v.isSet = true +} + +func (v NullableOrganization) IsSet() bool { + return v.isSet +} + +func (v *NullableOrganization) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOrganization(val *Organization) *NullableOrganization { + return &NullableOrganization{value: val, isSet: true} +} + +func (v NullableOrganization) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOrganization) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization_input.go new file mode 100644 index 00000000..8ce87c90 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization_input.go @@ -0,0 +1,453 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the OrganizationInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OrganizationInput{} + +// OrganizationInput struct for OrganizationInput +type OrganizationInput struct { + Address *Address `json:"address,omitempty"` + BillingAddress *Address `json:"billing_address,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Description *string `json:"description,omitempty"` + // Force to all members to have enabled the two factor authentication after that date, unless the value is null + Enforce2faAt *time.Time `json:"enforce_2fa_at,omitempty"` + // The logo for the organization; must be base64-encoded image data + Logo *string `json:"logo,omitempty"` + Name *string `json:"name,omitempty"` + Twitter *string `json:"twitter,omitempty"` + Website *string `json:"website,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _OrganizationInput OrganizationInput + +// NewOrganizationInput instantiates a new OrganizationInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOrganizationInput() *OrganizationInput { + this := OrganizationInput{} + return &this +} + +// NewOrganizationInputWithDefaults instantiates a new OrganizationInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOrganizationInputWithDefaults() *OrganizationInput { + this := OrganizationInput{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *OrganizationInput) GetAddress() Address { + if o == nil || IsNil(o.Address) { + var ret Address + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationInput) GetAddressOk() (*Address, bool) { + if o == nil || IsNil(o.Address) { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *OrganizationInput) HasAddress() bool { + if o != nil && !IsNil(o.Address) { + return true + } + + return false +} + +// SetAddress gets a reference to the given Address and assigns it to the Address field. +func (o *OrganizationInput) SetAddress(v Address) { + o.Address = &v +} + +// GetBillingAddress returns the BillingAddress field value if set, zero value otherwise. +func (o *OrganizationInput) GetBillingAddress() Address { + if o == nil || IsNil(o.BillingAddress) { + var ret Address + return ret + } + return *o.BillingAddress +} + +// GetBillingAddressOk returns a tuple with the BillingAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationInput) GetBillingAddressOk() (*Address, bool) { + if o == nil || IsNil(o.BillingAddress) { + return nil, false + } + return o.BillingAddress, true +} + +// HasBillingAddress returns a boolean if a field has been set. +func (o *OrganizationInput) HasBillingAddress() bool { + if o != nil && !IsNil(o.BillingAddress) { + return true + } + + return false +} + +// SetBillingAddress gets a reference to the given Address and assigns it to the BillingAddress field. +func (o *OrganizationInput) SetBillingAddress(v Address) { + o.BillingAddress = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *OrganizationInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *OrganizationInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *OrganizationInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *OrganizationInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *OrganizationInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *OrganizationInput) SetDescription(v string) { + o.Description = &v +} + +// GetEnforce2faAt returns the Enforce2faAt field value if set, zero value otherwise. +func (o *OrganizationInput) GetEnforce2faAt() time.Time { + if o == nil || IsNil(o.Enforce2faAt) { + var ret time.Time + return ret + } + return *o.Enforce2faAt +} + +// GetEnforce2faAtOk returns a tuple with the Enforce2faAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationInput) GetEnforce2faAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.Enforce2faAt) { + return nil, false + } + return o.Enforce2faAt, true +} + +// HasEnforce2faAt returns a boolean if a field has been set. +func (o *OrganizationInput) HasEnforce2faAt() bool { + if o != nil && !IsNil(o.Enforce2faAt) { + return true + } + + return false +} + +// SetEnforce2faAt gets a reference to the given time.Time and assigns it to the Enforce2faAt field. +func (o *OrganizationInput) SetEnforce2faAt(v time.Time) { + o.Enforce2faAt = &v +} + +// GetLogo returns the Logo field value if set, zero value otherwise. +func (o *OrganizationInput) GetLogo() string { + if o == nil || IsNil(o.Logo) { + var ret string + return ret + } + return *o.Logo +} + +// GetLogoOk returns a tuple with the Logo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationInput) GetLogoOk() (*string, bool) { + if o == nil || IsNil(o.Logo) { + return nil, false + } + return o.Logo, true +} + +// HasLogo returns a boolean if a field has been set. +func (o *OrganizationInput) HasLogo() bool { + if o != nil && !IsNil(o.Logo) { + return true + } + + return false +} + +// SetLogo gets a reference to the given string and assigns it to the Logo field. +func (o *OrganizationInput) SetLogo(v string) { + o.Logo = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *OrganizationInput) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationInput) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *OrganizationInput) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *OrganizationInput) SetName(v string) { + o.Name = &v +} + +// GetTwitter returns the Twitter field value if set, zero value otherwise. +func (o *OrganizationInput) GetTwitter() string { + if o == nil || IsNil(o.Twitter) { + var ret string + return ret + } + return *o.Twitter +} + +// GetTwitterOk returns a tuple with the Twitter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationInput) GetTwitterOk() (*string, bool) { + if o == nil || IsNil(o.Twitter) { + return nil, false + } + return o.Twitter, true +} + +// HasTwitter returns a boolean if a field has been set. +func (o *OrganizationInput) HasTwitter() bool { + if o != nil && !IsNil(o.Twitter) { + return true + } + + return false +} + +// SetTwitter gets a reference to the given string and assigns it to the Twitter field. +func (o *OrganizationInput) SetTwitter(v string) { + o.Twitter = &v +} + +// GetWebsite returns the Website field value if set, zero value otherwise. +func (o *OrganizationInput) GetWebsite() string { + if o == nil || IsNil(o.Website) { + var ret string + return ret + } + return *o.Website +} + +// GetWebsiteOk returns a tuple with the Website field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationInput) GetWebsiteOk() (*string, bool) { + if o == nil || IsNil(o.Website) { + return nil, false + } + return o.Website, true +} + +// HasWebsite returns a boolean if a field has been set. +func (o *OrganizationInput) HasWebsite() bool { + if o != nil && !IsNil(o.Website) { + return true + } + + return false +} + +// SetWebsite gets a reference to the given string and assigns it to the Website field. +func (o *OrganizationInput) SetWebsite(v string) { + o.Website = &v +} + +func (o OrganizationInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OrganizationInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Address) { + toSerialize["address"] = o.Address + } + if !IsNil(o.BillingAddress) { + toSerialize["billing_address"] = o.BillingAddress + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Enforce2faAt) { + toSerialize["enforce_2fa_at"] = o.Enforce2faAt + } + if !IsNil(o.Logo) { + toSerialize["logo"] = o.Logo + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Twitter) { + toSerialize["twitter"] = o.Twitter + } + if !IsNil(o.Website) { + toSerialize["website"] = o.Website + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *OrganizationInput) UnmarshalJSON(data []byte) (err error) { + varOrganizationInput := _OrganizationInput{} + + err = json.Unmarshal(data, &varOrganizationInput) + + if err != nil { + return err + } + + *o = OrganizationInput(varOrganizationInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "billing_address") + delete(additionalProperties, "customdata") + delete(additionalProperties, "description") + delete(additionalProperties, "enforce_2fa_at") + delete(additionalProperties, "logo") + delete(additionalProperties, "name") + delete(additionalProperties, "twitter") + delete(additionalProperties, "website") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOrganizationInput struct { + value *OrganizationInput + isSet bool +} + +func (v NullableOrganizationInput) Get() *OrganizationInput { + return v.value +} + +func (v *NullableOrganizationInput) Set(val *OrganizationInput) { + v.value = val + v.isSet = true +} + +func (v NullableOrganizationInput) IsSet() bool { + return v.isSet +} + +func (v *NullableOrganizationInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOrganizationInput(val *OrganizationInput) *NullableOrganizationInput { + return &NullableOrganizationInput{value: val, isSet: true} +} + +func (v NullableOrganizationInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOrganizationInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization_list.go new file mode 100644 index 00000000..b7b2c032 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_organization_list.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the OrganizationList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OrganizationList{} + +// OrganizationList struct for OrganizationList +type OrganizationList struct { + Meta *Meta `json:"meta,omitempty"` + Organizations []Organization `json:"organizations,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _OrganizationList OrganizationList + +// NewOrganizationList instantiates a new OrganizationList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOrganizationList() *OrganizationList { + this := OrganizationList{} + return &this +} + +// NewOrganizationListWithDefaults instantiates a new OrganizationList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOrganizationListWithDefaults() *OrganizationList { + this := OrganizationList{} + return &this +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *OrganizationList) GetMeta() Meta { + if o == nil || IsNil(o.Meta) { + var ret Meta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationList) GetMetaOk() (*Meta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *OrganizationList) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given Meta and assigns it to the Meta field. +func (o *OrganizationList) SetMeta(v Meta) { + o.Meta = &v +} + +// GetOrganizations returns the Organizations field value if set, zero value otherwise. +func (o *OrganizationList) GetOrganizations() []Organization { + if o == nil || IsNil(o.Organizations) { + var ret []Organization + return ret + } + return o.Organizations +} + +// GetOrganizationsOk returns a tuple with the Organizations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrganizationList) GetOrganizationsOk() ([]Organization, bool) { + if o == nil || IsNil(o.Organizations) { + return nil, false + } + return o.Organizations, true +} + +// HasOrganizations returns a boolean if a field has been set. +func (o *OrganizationList) HasOrganizations() bool { + if o != nil && !IsNil(o.Organizations) { + return true + } + + return false +} + +// SetOrganizations gets a reference to the given []Organization and assigns it to the Organizations field. +func (o *OrganizationList) SetOrganizations(v []Organization) { + o.Organizations = v +} + +func (o OrganizationList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OrganizationList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + if !IsNil(o.Organizations) { + toSerialize["organizations"] = o.Organizations + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *OrganizationList) UnmarshalJSON(data []byte) (err error) { + varOrganizationList := _OrganizationList{} + + err = json.Unmarshal(data, &varOrganizationList) + + if err != nil { + return err + } + + *o = OrganizationList(varOrganizationList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "meta") + delete(additionalProperties, "organizations") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOrganizationList struct { + value *OrganizationList + isSet bool +} + +func (v NullableOrganizationList) Get() *OrganizationList { + return v.value +} + +func (v *NullableOrganizationList) Set(val *OrganizationList) { + v.value = val + v.isSet = true +} + +func (v NullableOrganizationList) IsSet() bool { + return v.isSet +} + +func (v *NullableOrganizationList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOrganizationList(val *OrganizationList) *NullableOrganizationList { + return &NullableOrganizationList{value: val, isSet: true} +} + +func (v NullableOrganizationList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOrganizationList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_otp_seed.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_otp_seed.go new file mode 100644 index 00000000..fb848bb8 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_otp_seed.go @@ -0,0 +1,155 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the OtpSeed type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OtpSeed{} + +// OtpSeed Details for configuring your MFA app +type OtpSeed struct { + // The URI to use in your MFA app + OtpUri *string `json:"otp_uri,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _OtpSeed OtpSeed + +// NewOtpSeed instantiates a new OtpSeed object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOtpSeed() *OtpSeed { + this := OtpSeed{} + return &this +} + +// NewOtpSeedWithDefaults instantiates a new OtpSeed object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOtpSeedWithDefaults() *OtpSeed { + this := OtpSeed{} + return &this +} + +// GetOtpUri returns the OtpUri field value if set, zero value otherwise. +func (o *OtpSeed) GetOtpUri() string { + if o == nil || IsNil(o.OtpUri) { + var ret string + return ret + } + return *o.OtpUri +} + +// GetOtpUriOk returns a tuple with the OtpUri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OtpSeed) GetOtpUriOk() (*string, bool) { + if o == nil || IsNil(o.OtpUri) { + return nil, false + } + return o.OtpUri, true +} + +// HasOtpUri returns a boolean if a field has been set. +func (o *OtpSeed) HasOtpUri() bool { + if o != nil && !IsNil(o.OtpUri) { + return true + } + + return false +} + +// SetOtpUri gets a reference to the given string and assigns it to the OtpUri field. +func (o *OtpSeed) SetOtpUri(v string) { + o.OtpUri = &v +} + +func (o OtpSeed) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OtpSeed) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.OtpUri) { + toSerialize["otp_uri"] = o.OtpUri + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *OtpSeed) UnmarshalJSON(data []byte) (err error) { + varOtpSeed := _OtpSeed{} + + err = json.Unmarshal(data, &varOtpSeed) + + if err != nil { + return err + } + + *o = OtpSeed(varOtpSeed) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "otp_uri") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOtpSeed struct { + value *OtpSeed + isSet bool +} + +func (v NullableOtpSeed) Get() *OtpSeed { + return v.value +} + +func (v *NullableOtpSeed) Set(val *OtpSeed) { + v.value = val + v.isSet = true +} + +func (v NullableOtpSeed) IsSet() bool { + return v.isSet +} + +func (v *NullableOtpSeed) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOtpSeed(val *OtpSeed) *NullableOtpSeed { + return &NullableOtpSeed{value: val, isSet: true} +} + +func (v NullableOtpSeed) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOtpSeed) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_parent_block.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_parent_block.go new file mode 100644 index 00000000..7f0ff8f2 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_parent_block.go @@ -0,0 +1,265 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the ParentBlock type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ParentBlock{} + +// ParentBlock struct for ParentBlock +type ParentBlock struct { + Cidr *int32 `json:"cidr,omitempty"` + Href *string `json:"href,omitempty"` + Netmask *string `json:"netmask,omitempty"` + Network *string `json:"network,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ParentBlock ParentBlock + +// NewParentBlock instantiates a new ParentBlock object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewParentBlock() *ParentBlock { + this := ParentBlock{} + return &this +} + +// NewParentBlockWithDefaults instantiates a new ParentBlock object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewParentBlockWithDefaults() *ParentBlock { + this := ParentBlock{} + return &this +} + +// GetCidr returns the Cidr field value if set, zero value otherwise. +func (o *ParentBlock) GetCidr() int32 { + if o == nil || IsNil(o.Cidr) { + var ret int32 + return ret + } + return *o.Cidr +} + +// GetCidrOk returns a tuple with the Cidr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ParentBlock) GetCidrOk() (*int32, bool) { + if o == nil || IsNil(o.Cidr) { + return nil, false + } + return o.Cidr, true +} + +// HasCidr returns a boolean if a field has been set. +func (o *ParentBlock) HasCidr() bool { + if o != nil && !IsNil(o.Cidr) { + return true + } + + return false +} + +// SetCidr gets a reference to the given int32 and assigns it to the Cidr field. +func (o *ParentBlock) SetCidr(v int32) { + o.Cidr = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *ParentBlock) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ParentBlock) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *ParentBlock) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *ParentBlock) SetHref(v string) { + o.Href = &v +} + +// GetNetmask returns the Netmask field value if set, zero value otherwise. +func (o *ParentBlock) GetNetmask() string { + if o == nil || IsNil(o.Netmask) { + var ret string + return ret + } + return *o.Netmask +} + +// GetNetmaskOk returns a tuple with the Netmask field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ParentBlock) GetNetmaskOk() (*string, bool) { + if o == nil || IsNil(o.Netmask) { + return nil, false + } + return o.Netmask, true +} + +// HasNetmask returns a boolean if a field has been set. +func (o *ParentBlock) HasNetmask() bool { + if o != nil && !IsNil(o.Netmask) { + return true + } + + return false +} + +// SetNetmask gets a reference to the given string and assigns it to the Netmask field. +func (o *ParentBlock) SetNetmask(v string) { + o.Netmask = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *ParentBlock) GetNetwork() string { + if o == nil || IsNil(o.Network) { + var ret string + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ParentBlock) GetNetworkOk() (*string, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *ParentBlock) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given string and assigns it to the Network field. +func (o *ParentBlock) SetNetwork(v string) { + o.Network = &v +} + +func (o ParentBlock) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ParentBlock) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Cidr) { + toSerialize["cidr"] = o.Cidr + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Netmask) { + toSerialize["netmask"] = o.Netmask + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ParentBlock) UnmarshalJSON(data []byte) (err error) { + varParentBlock := _ParentBlock{} + + err = json.Unmarshal(data, &varParentBlock) + + if err != nil { + return err + } + + *o = ParentBlock(varParentBlock) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cidr") + delete(additionalProperties, "href") + delete(additionalProperties, "netmask") + delete(additionalProperties, "network") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableParentBlock struct { + value *ParentBlock + isSet bool +} + +func (v NullableParentBlock) Get() *ParentBlock { + return v.value +} + +func (v *NullableParentBlock) Set(val *ParentBlock) { + v.value = val + v.isSet = true +} + +func (v NullableParentBlock) IsSet() bool { + return v.isSet +} + +func (v *NullableParentBlock) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableParentBlock(val *ParentBlock) *NullableParentBlock { + return &NullableParentBlock{value: val, isSet: true} +} + +func (v NullableParentBlock) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableParentBlock) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_partition.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_partition.go new file mode 100644 index 00000000..4b065c73 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_partition.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Partition type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Partition{} + +// Partition struct for Partition +type Partition struct { + Label *string `json:"label,omitempty"` + Number *int32 `json:"number,omitempty"` + Size *string `json:"size,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Partition Partition + +// NewPartition instantiates a new Partition object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPartition() *Partition { + this := Partition{} + return &this +} + +// NewPartitionWithDefaults instantiates a new Partition object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPartitionWithDefaults() *Partition { + this := Partition{} + return &this +} + +// GetLabel returns the Label field value if set, zero value otherwise. +func (o *Partition) GetLabel() string { + if o == nil || IsNil(o.Label) { + var ret string + return ret + } + return *o.Label +} + +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Partition) GetLabelOk() (*string, bool) { + if o == nil || IsNil(o.Label) { + return nil, false + } + return o.Label, true +} + +// HasLabel returns a boolean if a field has been set. +func (o *Partition) HasLabel() bool { + if o != nil && !IsNil(o.Label) { + return true + } + + return false +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. +func (o *Partition) SetLabel(v string) { + o.Label = &v +} + +// GetNumber returns the Number field value if set, zero value otherwise. +func (o *Partition) GetNumber() int32 { + if o == nil || IsNil(o.Number) { + var ret int32 + return ret + } + return *o.Number +} + +// GetNumberOk returns a tuple with the Number field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Partition) GetNumberOk() (*int32, bool) { + if o == nil || IsNil(o.Number) { + return nil, false + } + return o.Number, true +} + +// HasNumber returns a boolean if a field has been set. +func (o *Partition) HasNumber() bool { + if o != nil && !IsNil(o.Number) { + return true + } + + return false +} + +// SetNumber gets a reference to the given int32 and assigns it to the Number field. +func (o *Partition) SetNumber(v int32) { + o.Number = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Partition) GetSize() string { + if o == nil || IsNil(o.Size) { + var ret string + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Partition) GetSizeOk() (*string, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *Partition) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given string and assigns it to the Size field. +func (o *Partition) SetSize(v string) { + o.Size = &v +} + +func (o Partition) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Partition) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Label) { + toSerialize["label"] = o.Label + } + if !IsNil(o.Number) { + toSerialize["number"] = o.Number + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Partition) UnmarshalJSON(data []byte) (err error) { + varPartition := _Partition{} + + err = json.Unmarshal(data, &varPartition) + + if err != nil { + return err + } + + *o = Partition(varPartition) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "label") + delete(additionalProperties, "number") + delete(additionalProperties, "size") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePartition struct { + value *Partition + isSet bool +} + +func (v NullablePartition) Get() *Partition { + return v.value +} + +func (v *NullablePartition) Set(val *Partition) { + v.value = val + v.isSet = true +} + +func (v NullablePartition) IsSet() bool { + return v.isSet +} + +func (v *NullablePartition) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartition(val *Partition) *NullablePartition { + return &NullablePartition{value: val, isSet: true} +} + +func (v NullablePartition) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartition) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method.go new file mode 100644 index 00000000..d3fa8022 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method.go @@ -0,0 +1,673 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the PaymentMethod type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PaymentMethod{} + +// PaymentMethod struct for PaymentMethod +type PaymentMethod struct { + BillingAddress *PaymentMethodBillingAddress `json:"billing_address,omitempty"` + CardType *string `json:"card_type,omitempty"` + CardholderName *string `json:"cardholder_name,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + CreatedByUser *Href `json:"created_by_user,omitempty"` + Default *bool `json:"default,omitempty"` + Email *string `json:"email,omitempty"` + ExpirationMonth *string `json:"expiration_month,omitempty"` + ExpirationYear *string `json:"expiration_year,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Organization *Href `json:"organization,omitempty"` + Projects []Href `json:"projects,omitempty"` + Type *string `json:"type,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PaymentMethod PaymentMethod + +// NewPaymentMethod instantiates a new PaymentMethod object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPaymentMethod() *PaymentMethod { + this := PaymentMethod{} + return &this +} + +// NewPaymentMethodWithDefaults instantiates a new PaymentMethod object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPaymentMethodWithDefaults() *PaymentMethod { + this := PaymentMethod{} + return &this +} + +// GetBillingAddress returns the BillingAddress field value if set, zero value otherwise. +func (o *PaymentMethod) GetBillingAddress() PaymentMethodBillingAddress { + if o == nil || IsNil(o.BillingAddress) { + var ret PaymentMethodBillingAddress + return ret + } + return *o.BillingAddress +} + +// GetBillingAddressOk returns a tuple with the BillingAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetBillingAddressOk() (*PaymentMethodBillingAddress, bool) { + if o == nil || IsNil(o.BillingAddress) { + return nil, false + } + return o.BillingAddress, true +} + +// HasBillingAddress returns a boolean if a field has been set. +func (o *PaymentMethod) HasBillingAddress() bool { + if o != nil && !IsNil(o.BillingAddress) { + return true + } + + return false +} + +// SetBillingAddress gets a reference to the given PaymentMethodBillingAddress and assigns it to the BillingAddress field. +func (o *PaymentMethod) SetBillingAddress(v PaymentMethodBillingAddress) { + o.BillingAddress = &v +} + +// GetCardType returns the CardType field value if set, zero value otherwise. +func (o *PaymentMethod) GetCardType() string { + if o == nil || IsNil(o.CardType) { + var ret string + return ret + } + return *o.CardType +} + +// GetCardTypeOk returns a tuple with the CardType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetCardTypeOk() (*string, bool) { + if o == nil || IsNil(o.CardType) { + return nil, false + } + return o.CardType, true +} + +// HasCardType returns a boolean if a field has been set. +func (o *PaymentMethod) HasCardType() bool { + if o != nil && !IsNil(o.CardType) { + return true + } + + return false +} + +// SetCardType gets a reference to the given string and assigns it to the CardType field. +func (o *PaymentMethod) SetCardType(v string) { + o.CardType = &v +} + +// GetCardholderName returns the CardholderName field value if set, zero value otherwise. +func (o *PaymentMethod) GetCardholderName() string { + if o == nil || IsNil(o.CardholderName) { + var ret string + return ret + } + return *o.CardholderName +} + +// GetCardholderNameOk returns a tuple with the CardholderName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetCardholderNameOk() (*string, bool) { + if o == nil || IsNil(o.CardholderName) { + return nil, false + } + return o.CardholderName, true +} + +// HasCardholderName returns a boolean if a field has been set. +func (o *PaymentMethod) HasCardholderName() bool { + if o != nil && !IsNil(o.CardholderName) { + return true + } + + return false +} + +// SetCardholderName gets a reference to the given string and assigns it to the CardholderName field. +func (o *PaymentMethod) SetCardholderName(v string) { + o.CardholderName = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *PaymentMethod) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *PaymentMethod) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *PaymentMethod) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCreatedByUser returns the CreatedByUser field value if set, zero value otherwise. +func (o *PaymentMethod) GetCreatedByUser() Href { + if o == nil || IsNil(o.CreatedByUser) { + var ret Href + return ret + } + return *o.CreatedByUser +} + +// GetCreatedByUserOk returns a tuple with the CreatedByUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetCreatedByUserOk() (*Href, bool) { + if o == nil || IsNil(o.CreatedByUser) { + return nil, false + } + return o.CreatedByUser, true +} + +// HasCreatedByUser returns a boolean if a field has been set. +func (o *PaymentMethod) HasCreatedByUser() bool { + if o != nil && !IsNil(o.CreatedByUser) { + return true + } + + return false +} + +// SetCreatedByUser gets a reference to the given Href and assigns it to the CreatedByUser field. +func (o *PaymentMethod) SetCreatedByUser(v Href) { + o.CreatedByUser = &v +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *PaymentMethod) GetDefault() bool { + if o == nil || IsNil(o.Default) { + var ret bool + return ret + } + return *o.Default +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetDefaultOk() (*bool, bool) { + if o == nil || IsNil(o.Default) { + return nil, false + } + return o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *PaymentMethod) HasDefault() bool { + if o != nil && !IsNil(o.Default) { + return true + } + + return false +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *PaymentMethod) SetDefault(v bool) { + o.Default = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *PaymentMethod) GetEmail() string { + if o == nil || IsNil(o.Email) { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetEmailOk() (*string, bool) { + if o == nil || IsNil(o.Email) { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *PaymentMethod) HasEmail() bool { + if o != nil && !IsNil(o.Email) { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *PaymentMethod) SetEmail(v string) { + o.Email = &v +} + +// GetExpirationMonth returns the ExpirationMonth field value if set, zero value otherwise. +func (o *PaymentMethod) GetExpirationMonth() string { + if o == nil || IsNil(o.ExpirationMonth) { + var ret string + return ret + } + return *o.ExpirationMonth +} + +// GetExpirationMonthOk returns a tuple with the ExpirationMonth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetExpirationMonthOk() (*string, bool) { + if o == nil || IsNil(o.ExpirationMonth) { + return nil, false + } + return o.ExpirationMonth, true +} + +// HasExpirationMonth returns a boolean if a field has been set. +func (o *PaymentMethod) HasExpirationMonth() bool { + if o != nil && !IsNil(o.ExpirationMonth) { + return true + } + + return false +} + +// SetExpirationMonth gets a reference to the given string and assigns it to the ExpirationMonth field. +func (o *PaymentMethod) SetExpirationMonth(v string) { + o.ExpirationMonth = &v +} + +// GetExpirationYear returns the ExpirationYear field value if set, zero value otherwise. +func (o *PaymentMethod) GetExpirationYear() string { + if o == nil || IsNil(o.ExpirationYear) { + var ret string + return ret + } + return *o.ExpirationYear +} + +// GetExpirationYearOk returns a tuple with the ExpirationYear field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetExpirationYearOk() (*string, bool) { + if o == nil || IsNil(o.ExpirationYear) { + return nil, false + } + return o.ExpirationYear, true +} + +// HasExpirationYear returns a boolean if a field has been set. +func (o *PaymentMethod) HasExpirationYear() bool { + if o != nil && !IsNil(o.ExpirationYear) { + return true + } + + return false +} + +// SetExpirationYear gets a reference to the given string and assigns it to the ExpirationYear field. +func (o *PaymentMethod) SetExpirationYear(v string) { + o.ExpirationYear = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PaymentMethod) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *PaymentMethod) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PaymentMethod) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PaymentMethod) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *PaymentMethod) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PaymentMethod) SetName(v string) { + o.Name = &v +} + +// GetOrganization returns the Organization field value if set, zero value otherwise. +func (o *PaymentMethod) GetOrganization() Href { + if o == nil || IsNil(o.Organization) { + var ret Href + return ret + } + return *o.Organization +} + +// GetOrganizationOk returns a tuple with the Organization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetOrganizationOk() (*Href, bool) { + if o == nil || IsNil(o.Organization) { + return nil, false + } + return o.Organization, true +} + +// HasOrganization returns a boolean if a field has been set. +func (o *PaymentMethod) HasOrganization() bool { + if o != nil && !IsNil(o.Organization) { + return true + } + + return false +} + +// SetOrganization gets a reference to the given Href and assigns it to the Organization field. +func (o *PaymentMethod) SetOrganization(v Href) { + o.Organization = &v +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *PaymentMethod) GetProjects() []Href { + if o == nil || IsNil(o.Projects) { + var ret []Href + return ret + } + return o.Projects +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetProjectsOk() ([]Href, bool) { + if o == nil || IsNil(o.Projects) { + return nil, false + } + return o.Projects, true +} + +// HasProjects returns a boolean if a field has been set. +func (o *PaymentMethod) HasProjects() bool { + if o != nil && !IsNil(o.Projects) { + return true + } + + return false +} + +// SetProjects gets a reference to the given []Href and assigns it to the Projects field. +func (o *PaymentMethod) SetProjects(v []Href) { + o.Projects = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *PaymentMethod) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *PaymentMethod) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *PaymentMethod) SetType(v string) { + o.Type = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *PaymentMethod) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethod) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *PaymentMethod) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *PaymentMethod) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o PaymentMethod) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PaymentMethod) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BillingAddress) { + toSerialize["billing_address"] = o.BillingAddress + } + if !IsNil(o.CardType) { + toSerialize["card_type"] = o.CardType + } + if !IsNil(o.CardholderName) { + toSerialize["cardholder_name"] = o.CardholderName + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.CreatedByUser) { + toSerialize["created_by_user"] = o.CreatedByUser + } + if !IsNil(o.Default) { + toSerialize["default"] = o.Default + } + if !IsNil(o.Email) { + toSerialize["email"] = o.Email + } + if !IsNil(o.ExpirationMonth) { + toSerialize["expiration_month"] = o.ExpirationMonth + } + if !IsNil(o.ExpirationYear) { + toSerialize["expiration_year"] = o.ExpirationYear + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Organization) { + toSerialize["organization"] = o.Organization + } + if !IsNil(o.Projects) { + toSerialize["projects"] = o.Projects + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PaymentMethod) UnmarshalJSON(data []byte) (err error) { + varPaymentMethod := _PaymentMethod{} + + err = json.Unmarshal(data, &varPaymentMethod) + + if err != nil { + return err + } + + *o = PaymentMethod(varPaymentMethod) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "billing_address") + delete(additionalProperties, "card_type") + delete(additionalProperties, "cardholder_name") + delete(additionalProperties, "created_at") + delete(additionalProperties, "created_by_user") + delete(additionalProperties, "default") + delete(additionalProperties, "email") + delete(additionalProperties, "expiration_month") + delete(additionalProperties, "expiration_year") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "organization") + delete(additionalProperties, "projects") + delete(additionalProperties, "type") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePaymentMethod struct { + value *PaymentMethod + isSet bool +} + +func (v NullablePaymentMethod) Get() *PaymentMethod { + return v.value +} + +func (v *NullablePaymentMethod) Set(val *PaymentMethod) { + v.value = val + v.isSet = true +} + +func (v NullablePaymentMethod) IsSet() bool { + return v.isSet +} + +func (v *NullablePaymentMethod) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePaymentMethod(val *PaymentMethod) *NullablePaymentMethod { + return &NullablePaymentMethod{value: val, isSet: true} +} + +func (v NullablePaymentMethod) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePaymentMethod) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_billing_address.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_billing_address.go new file mode 100644 index 00000000..c83819d2 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_billing_address.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PaymentMethodBillingAddress type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PaymentMethodBillingAddress{} + +// PaymentMethodBillingAddress struct for PaymentMethodBillingAddress +type PaymentMethodBillingAddress struct { + CountryCodeAlpha2 *string `json:"country_code_alpha2,omitempty"` + PostalCode *string `json:"postal_code,omitempty"` + StreetAddress *string `json:"street_address,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PaymentMethodBillingAddress PaymentMethodBillingAddress + +// NewPaymentMethodBillingAddress instantiates a new PaymentMethodBillingAddress object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPaymentMethodBillingAddress() *PaymentMethodBillingAddress { + this := PaymentMethodBillingAddress{} + return &this +} + +// NewPaymentMethodBillingAddressWithDefaults instantiates a new PaymentMethodBillingAddress object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPaymentMethodBillingAddressWithDefaults() *PaymentMethodBillingAddress { + this := PaymentMethodBillingAddress{} + return &this +} + +// GetCountryCodeAlpha2 returns the CountryCodeAlpha2 field value if set, zero value otherwise. +func (o *PaymentMethodBillingAddress) GetCountryCodeAlpha2() string { + if o == nil || IsNil(o.CountryCodeAlpha2) { + var ret string + return ret + } + return *o.CountryCodeAlpha2 +} + +// GetCountryCodeAlpha2Ok returns a tuple with the CountryCodeAlpha2 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethodBillingAddress) GetCountryCodeAlpha2Ok() (*string, bool) { + if o == nil || IsNil(o.CountryCodeAlpha2) { + return nil, false + } + return o.CountryCodeAlpha2, true +} + +// HasCountryCodeAlpha2 returns a boolean if a field has been set. +func (o *PaymentMethodBillingAddress) HasCountryCodeAlpha2() bool { + if o != nil && !IsNil(o.CountryCodeAlpha2) { + return true + } + + return false +} + +// SetCountryCodeAlpha2 gets a reference to the given string and assigns it to the CountryCodeAlpha2 field. +func (o *PaymentMethodBillingAddress) SetCountryCodeAlpha2(v string) { + o.CountryCodeAlpha2 = &v +} + +// GetPostalCode returns the PostalCode field value if set, zero value otherwise. +func (o *PaymentMethodBillingAddress) GetPostalCode() string { + if o == nil || IsNil(o.PostalCode) { + var ret string + return ret + } + return *o.PostalCode +} + +// GetPostalCodeOk returns a tuple with the PostalCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethodBillingAddress) GetPostalCodeOk() (*string, bool) { + if o == nil || IsNil(o.PostalCode) { + return nil, false + } + return o.PostalCode, true +} + +// HasPostalCode returns a boolean if a field has been set. +func (o *PaymentMethodBillingAddress) HasPostalCode() bool { + if o != nil && !IsNil(o.PostalCode) { + return true + } + + return false +} + +// SetPostalCode gets a reference to the given string and assigns it to the PostalCode field. +func (o *PaymentMethodBillingAddress) SetPostalCode(v string) { + o.PostalCode = &v +} + +// GetStreetAddress returns the StreetAddress field value if set, zero value otherwise. +func (o *PaymentMethodBillingAddress) GetStreetAddress() string { + if o == nil || IsNil(o.StreetAddress) { + var ret string + return ret + } + return *o.StreetAddress +} + +// GetStreetAddressOk returns a tuple with the StreetAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethodBillingAddress) GetStreetAddressOk() (*string, bool) { + if o == nil || IsNil(o.StreetAddress) { + return nil, false + } + return o.StreetAddress, true +} + +// HasStreetAddress returns a boolean if a field has been set. +func (o *PaymentMethodBillingAddress) HasStreetAddress() bool { + if o != nil && !IsNil(o.StreetAddress) { + return true + } + + return false +} + +// SetStreetAddress gets a reference to the given string and assigns it to the StreetAddress field. +func (o *PaymentMethodBillingAddress) SetStreetAddress(v string) { + o.StreetAddress = &v +} + +func (o PaymentMethodBillingAddress) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PaymentMethodBillingAddress) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CountryCodeAlpha2) { + toSerialize["country_code_alpha2"] = o.CountryCodeAlpha2 + } + if !IsNil(o.PostalCode) { + toSerialize["postal_code"] = o.PostalCode + } + if !IsNil(o.StreetAddress) { + toSerialize["street_address"] = o.StreetAddress + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PaymentMethodBillingAddress) UnmarshalJSON(data []byte) (err error) { + varPaymentMethodBillingAddress := _PaymentMethodBillingAddress{} + + err = json.Unmarshal(data, &varPaymentMethodBillingAddress) + + if err != nil { + return err + } + + *o = PaymentMethodBillingAddress(varPaymentMethodBillingAddress) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "country_code_alpha2") + delete(additionalProperties, "postal_code") + delete(additionalProperties, "street_address") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePaymentMethodBillingAddress struct { + value *PaymentMethodBillingAddress + isSet bool +} + +func (v NullablePaymentMethodBillingAddress) Get() *PaymentMethodBillingAddress { + return v.value +} + +func (v *NullablePaymentMethodBillingAddress) Set(val *PaymentMethodBillingAddress) { + v.value = val + v.isSet = true +} + +func (v NullablePaymentMethodBillingAddress) IsSet() bool { + return v.isSet +} + +func (v *NullablePaymentMethodBillingAddress) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePaymentMethodBillingAddress(val *PaymentMethodBillingAddress) *NullablePaymentMethodBillingAddress { + return &NullablePaymentMethodBillingAddress{value: val, isSet: true} +} + +func (v NullablePaymentMethodBillingAddress) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePaymentMethodBillingAddress) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_create_input.go new file mode 100644 index 00000000..ef1674f1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_create_input.go @@ -0,0 +1,233 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the PaymentMethodCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PaymentMethodCreateInput{} + +// PaymentMethodCreateInput struct for PaymentMethodCreateInput +type PaymentMethodCreateInput struct { + Default *bool `json:"default,omitempty"` + Name string `json:"name"` + Nonce string `json:"nonce"` + AdditionalProperties map[string]interface{} +} + +type _PaymentMethodCreateInput PaymentMethodCreateInput + +// NewPaymentMethodCreateInput instantiates a new PaymentMethodCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPaymentMethodCreateInput(name string, nonce string) *PaymentMethodCreateInput { + this := PaymentMethodCreateInput{} + this.Name = name + this.Nonce = nonce + return &this +} + +// NewPaymentMethodCreateInputWithDefaults instantiates a new PaymentMethodCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPaymentMethodCreateInputWithDefaults() *PaymentMethodCreateInput { + this := PaymentMethodCreateInput{} + return &this +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *PaymentMethodCreateInput) GetDefault() bool { + if o == nil || IsNil(o.Default) { + var ret bool + return ret + } + return *o.Default +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethodCreateInput) GetDefaultOk() (*bool, bool) { + if o == nil || IsNil(o.Default) { + return nil, false + } + return o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *PaymentMethodCreateInput) HasDefault() bool { + if o != nil && !IsNil(o.Default) { + return true + } + + return false +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *PaymentMethodCreateInput) SetDefault(v bool) { + o.Default = &v +} + +// GetName returns the Name field value +func (o *PaymentMethodCreateInput) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *PaymentMethodCreateInput) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *PaymentMethodCreateInput) SetName(v string) { + o.Name = v +} + +// GetNonce returns the Nonce field value +func (o *PaymentMethodCreateInput) GetNonce() string { + if o == nil { + var ret string + return ret + } + + return o.Nonce +} + +// GetNonceOk returns a tuple with the Nonce field value +// and a boolean to check if the value has been set. +func (o *PaymentMethodCreateInput) GetNonceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Nonce, true +} + +// SetNonce sets field value +func (o *PaymentMethodCreateInput) SetNonce(v string) { + o.Nonce = v +} + +func (o PaymentMethodCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PaymentMethodCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Default) { + toSerialize["default"] = o.Default + } + toSerialize["name"] = o.Name + toSerialize["nonce"] = o.Nonce + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PaymentMethodCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "nonce", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varPaymentMethodCreateInput := _PaymentMethodCreateInput{} + + err = json.Unmarshal(data, &varPaymentMethodCreateInput) + + if err != nil { + return err + } + + *o = PaymentMethodCreateInput(varPaymentMethodCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "default") + delete(additionalProperties, "name") + delete(additionalProperties, "nonce") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePaymentMethodCreateInput struct { + value *PaymentMethodCreateInput + isSet bool +} + +func (v NullablePaymentMethodCreateInput) Get() *PaymentMethodCreateInput { + return v.value +} + +func (v *NullablePaymentMethodCreateInput) Set(val *PaymentMethodCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullablePaymentMethodCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullablePaymentMethodCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePaymentMethodCreateInput(val *PaymentMethodCreateInput) *NullablePaymentMethodCreateInput { + return &NullablePaymentMethodCreateInput{value: val, isSet: true} +} + +func (v NullablePaymentMethodCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePaymentMethodCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_list.go new file mode 100644 index 00000000..c3ae3ba4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PaymentMethodList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PaymentMethodList{} + +// PaymentMethodList struct for PaymentMethodList +type PaymentMethodList struct { + PaymentMethods []PaymentMethod `json:"payment_methods,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PaymentMethodList PaymentMethodList + +// NewPaymentMethodList instantiates a new PaymentMethodList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPaymentMethodList() *PaymentMethodList { + this := PaymentMethodList{} + return &this +} + +// NewPaymentMethodListWithDefaults instantiates a new PaymentMethodList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPaymentMethodListWithDefaults() *PaymentMethodList { + this := PaymentMethodList{} + return &this +} + +// GetPaymentMethods returns the PaymentMethods field value if set, zero value otherwise. +func (o *PaymentMethodList) GetPaymentMethods() []PaymentMethod { + if o == nil || IsNil(o.PaymentMethods) { + var ret []PaymentMethod + return ret + } + return o.PaymentMethods +} + +// GetPaymentMethodsOk returns a tuple with the PaymentMethods field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethodList) GetPaymentMethodsOk() ([]PaymentMethod, bool) { + if o == nil || IsNil(o.PaymentMethods) { + return nil, false + } + return o.PaymentMethods, true +} + +// HasPaymentMethods returns a boolean if a field has been set. +func (o *PaymentMethodList) HasPaymentMethods() bool { + if o != nil && !IsNil(o.PaymentMethods) { + return true + } + + return false +} + +// SetPaymentMethods gets a reference to the given []PaymentMethod and assigns it to the PaymentMethods field. +func (o *PaymentMethodList) SetPaymentMethods(v []PaymentMethod) { + o.PaymentMethods = v +} + +func (o PaymentMethodList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PaymentMethodList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.PaymentMethods) { + toSerialize["payment_methods"] = o.PaymentMethods + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PaymentMethodList) UnmarshalJSON(data []byte) (err error) { + varPaymentMethodList := _PaymentMethodList{} + + err = json.Unmarshal(data, &varPaymentMethodList) + + if err != nil { + return err + } + + *o = PaymentMethodList(varPaymentMethodList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "payment_methods") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePaymentMethodList struct { + value *PaymentMethodList + isSet bool +} + +func (v NullablePaymentMethodList) Get() *PaymentMethodList { + return v.value +} + +func (v *NullablePaymentMethodList) Set(val *PaymentMethodList) { + v.value = val + v.isSet = true +} + +func (v NullablePaymentMethodList) IsSet() bool { + return v.isSet +} + +func (v *NullablePaymentMethodList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePaymentMethodList(val *PaymentMethodList) *NullablePaymentMethodList { + return &NullablePaymentMethodList{value: val, isSet: true} +} + +func (v NullablePaymentMethodList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePaymentMethodList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_update_input.go new file mode 100644 index 00000000..2d280a7b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_payment_method_update_input.go @@ -0,0 +1,339 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PaymentMethodUpdateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PaymentMethodUpdateInput{} + +// PaymentMethodUpdateInput struct for PaymentMethodUpdateInput +type PaymentMethodUpdateInput struct { + BillingAddress map[string]interface{} `json:"billing_address,omitempty"` + CardholderName *string `json:"cardholder_name,omitempty"` + Default *bool `json:"default,omitempty"` + ExpirationMonth *string `json:"expiration_month,omitempty"` + ExpirationYear *int32 `json:"expiration_year,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PaymentMethodUpdateInput PaymentMethodUpdateInput + +// NewPaymentMethodUpdateInput instantiates a new PaymentMethodUpdateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPaymentMethodUpdateInput() *PaymentMethodUpdateInput { + this := PaymentMethodUpdateInput{} + return &this +} + +// NewPaymentMethodUpdateInputWithDefaults instantiates a new PaymentMethodUpdateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPaymentMethodUpdateInputWithDefaults() *PaymentMethodUpdateInput { + this := PaymentMethodUpdateInput{} + return &this +} + +// GetBillingAddress returns the BillingAddress field value if set, zero value otherwise. +func (o *PaymentMethodUpdateInput) GetBillingAddress() map[string]interface{} { + if o == nil || IsNil(o.BillingAddress) { + var ret map[string]interface{} + return ret + } + return o.BillingAddress +} + +// GetBillingAddressOk returns a tuple with the BillingAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethodUpdateInput) GetBillingAddressOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.BillingAddress) { + return map[string]interface{}{}, false + } + return o.BillingAddress, true +} + +// HasBillingAddress returns a boolean if a field has been set. +func (o *PaymentMethodUpdateInput) HasBillingAddress() bool { + if o != nil && !IsNil(o.BillingAddress) { + return true + } + + return false +} + +// SetBillingAddress gets a reference to the given map[string]interface{} and assigns it to the BillingAddress field. +func (o *PaymentMethodUpdateInput) SetBillingAddress(v map[string]interface{}) { + o.BillingAddress = v +} + +// GetCardholderName returns the CardholderName field value if set, zero value otherwise. +func (o *PaymentMethodUpdateInput) GetCardholderName() string { + if o == nil || IsNil(o.CardholderName) { + var ret string + return ret + } + return *o.CardholderName +} + +// GetCardholderNameOk returns a tuple with the CardholderName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethodUpdateInput) GetCardholderNameOk() (*string, bool) { + if o == nil || IsNil(o.CardholderName) { + return nil, false + } + return o.CardholderName, true +} + +// HasCardholderName returns a boolean if a field has been set. +func (o *PaymentMethodUpdateInput) HasCardholderName() bool { + if o != nil && !IsNil(o.CardholderName) { + return true + } + + return false +} + +// SetCardholderName gets a reference to the given string and assigns it to the CardholderName field. +func (o *PaymentMethodUpdateInput) SetCardholderName(v string) { + o.CardholderName = &v +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *PaymentMethodUpdateInput) GetDefault() bool { + if o == nil || IsNil(o.Default) { + var ret bool + return ret + } + return *o.Default +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethodUpdateInput) GetDefaultOk() (*bool, bool) { + if o == nil || IsNil(o.Default) { + return nil, false + } + return o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *PaymentMethodUpdateInput) HasDefault() bool { + if o != nil && !IsNil(o.Default) { + return true + } + + return false +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *PaymentMethodUpdateInput) SetDefault(v bool) { + o.Default = &v +} + +// GetExpirationMonth returns the ExpirationMonth field value if set, zero value otherwise. +func (o *PaymentMethodUpdateInput) GetExpirationMonth() string { + if o == nil || IsNil(o.ExpirationMonth) { + var ret string + return ret + } + return *o.ExpirationMonth +} + +// GetExpirationMonthOk returns a tuple with the ExpirationMonth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethodUpdateInput) GetExpirationMonthOk() (*string, bool) { + if o == nil || IsNil(o.ExpirationMonth) { + return nil, false + } + return o.ExpirationMonth, true +} + +// HasExpirationMonth returns a boolean if a field has been set. +func (o *PaymentMethodUpdateInput) HasExpirationMonth() bool { + if o != nil && !IsNil(o.ExpirationMonth) { + return true + } + + return false +} + +// SetExpirationMonth gets a reference to the given string and assigns it to the ExpirationMonth field. +func (o *PaymentMethodUpdateInput) SetExpirationMonth(v string) { + o.ExpirationMonth = &v +} + +// GetExpirationYear returns the ExpirationYear field value if set, zero value otherwise. +func (o *PaymentMethodUpdateInput) GetExpirationYear() int32 { + if o == nil || IsNil(o.ExpirationYear) { + var ret int32 + return ret + } + return *o.ExpirationYear +} + +// GetExpirationYearOk returns a tuple with the ExpirationYear field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethodUpdateInput) GetExpirationYearOk() (*int32, bool) { + if o == nil || IsNil(o.ExpirationYear) { + return nil, false + } + return o.ExpirationYear, true +} + +// HasExpirationYear returns a boolean if a field has been set. +func (o *PaymentMethodUpdateInput) HasExpirationYear() bool { + if o != nil && !IsNil(o.ExpirationYear) { + return true + } + + return false +} + +// SetExpirationYear gets a reference to the given int32 and assigns it to the ExpirationYear field. +func (o *PaymentMethodUpdateInput) SetExpirationYear(v int32) { + o.ExpirationYear = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PaymentMethodUpdateInput) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PaymentMethodUpdateInput) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *PaymentMethodUpdateInput) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PaymentMethodUpdateInput) SetName(v string) { + o.Name = &v +} + +func (o PaymentMethodUpdateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PaymentMethodUpdateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BillingAddress) { + toSerialize["billing_address"] = o.BillingAddress + } + if !IsNil(o.CardholderName) { + toSerialize["cardholder_name"] = o.CardholderName + } + if !IsNil(o.Default) { + toSerialize["default"] = o.Default + } + if !IsNil(o.ExpirationMonth) { + toSerialize["expiration_month"] = o.ExpirationMonth + } + if !IsNil(o.ExpirationYear) { + toSerialize["expiration_year"] = o.ExpirationYear + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PaymentMethodUpdateInput) UnmarshalJSON(data []byte) (err error) { + varPaymentMethodUpdateInput := _PaymentMethodUpdateInput{} + + err = json.Unmarshal(data, &varPaymentMethodUpdateInput) + + if err != nil { + return err + } + + *o = PaymentMethodUpdateInput(varPaymentMethodUpdateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "billing_address") + delete(additionalProperties, "cardholder_name") + delete(additionalProperties, "default") + delete(additionalProperties, "expiration_month") + delete(additionalProperties, "expiration_year") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePaymentMethodUpdateInput struct { + value *PaymentMethodUpdateInput + isSet bool +} + +func (v NullablePaymentMethodUpdateInput) Get() *PaymentMethodUpdateInput { + return v.value +} + +func (v *NullablePaymentMethodUpdateInput) Set(val *PaymentMethodUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullablePaymentMethodUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullablePaymentMethodUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePaymentMethodUpdateInput(val *PaymentMethodUpdateInput) *NullablePaymentMethodUpdateInput { + return &NullablePaymentMethodUpdateInput{value: val, isSet: true} +} + +func (v NullablePaymentMethodUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePaymentMethodUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan.go new file mode 100644 index 00000000..32f0151f --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan.go @@ -0,0 +1,639 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Plan type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Plan{} + +// Plan struct for Plan +type Plan struct { + // Shows which facilities the plan is available in, and the facility-based price if it is different from the default price. + AvailableIn []PlanAvailableInInner `json:"available_in,omitempty"` + // Shows which metros the plan is available in, and the metro-based price if it is different from the default price. + AvailableInMetros []PlanAvailableInMetrosInner `json:"available_in_metros,omitempty"` + // Categories of the plan, like compute or storage. A Plan can belong to multiple categories. + Categories []string `json:"categories,omitempty"` + Class *string `json:"class,omitempty"` + Description *string `json:"description,omitempty"` + DeploymentTypes []PlanDeploymentTypesInner `json:"deployment_types,omitempty"` + Id *string `json:"id,omitempty"` + // Deprecated. Always return false + Legacy *bool `json:"legacy,omitempty"` + Line *string `json:"line,omitempty"` + Name *string `json:"name,omitempty"` + Pricing map[string]interface{} `json:"pricing,omitempty"` + Slug *string `json:"slug,omitempty"` + Specs *PlanSpecs `json:"specs,omitempty"` + Type *PlanType `json:"type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Plan Plan + +// NewPlan instantiates a new Plan object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlan() *Plan { + this := Plan{} + return &this +} + +// NewPlanWithDefaults instantiates a new Plan object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanWithDefaults() *Plan { + this := Plan{} + return &this +} + +// GetAvailableIn returns the AvailableIn field value if set, zero value otherwise. +func (o *Plan) GetAvailableIn() []PlanAvailableInInner { + if o == nil || IsNil(o.AvailableIn) { + var ret []PlanAvailableInInner + return ret + } + return o.AvailableIn +} + +// GetAvailableInOk returns a tuple with the AvailableIn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetAvailableInOk() ([]PlanAvailableInInner, bool) { + if o == nil || IsNil(o.AvailableIn) { + return nil, false + } + return o.AvailableIn, true +} + +// HasAvailableIn returns a boolean if a field has been set. +func (o *Plan) HasAvailableIn() bool { + if o != nil && !IsNil(o.AvailableIn) { + return true + } + + return false +} + +// SetAvailableIn gets a reference to the given []PlanAvailableInInner and assigns it to the AvailableIn field. +func (o *Plan) SetAvailableIn(v []PlanAvailableInInner) { + o.AvailableIn = v +} + +// GetAvailableInMetros returns the AvailableInMetros field value if set, zero value otherwise. +func (o *Plan) GetAvailableInMetros() []PlanAvailableInMetrosInner { + if o == nil || IsNil(o.AvailableInMetros) { + var ret []PlanAvailableInMetrosInner + return ret + } + return o.AvailableInMetros +} + +// GetAvailableInMetrosOk returns a tuple with the AvailableInMetros field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetAvailableInMetrosOk() ([]PlanAvailableInMetrosInner, bool) { + if o == nil || IsNil(o.AvailableInMetros) { + return nil, false + } + return o.AvailableInMetros, true +} + +// HasAvailableInMetros returns a boolean if a field has been set. +func (o *Plan) HasAvailableInMetros() bool { + if o != nil && !IsNil(o.AvailableInMetros) { + return true + } + + return false +} + +// SetAvailableInMetros gets a reference to the given []PlanAvailableInMetrosInner and assigns it to the AvailableInMetros field. +func (o *Plan) SetAvailableInMetros(v []PlanAvailableInMetrosInner) { + o.AvailableInMetros = v +} + +// GetCategories returns the Categories field value if set, zero value otherwise. +func (o *Plan) GetCategories() []string { + if o == nil || IsNil(o.Categories) { + var ret []string + return ret + } + return o.Categories +} + +// GetCategoriesOk returns a tuple with the Categories field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetCategoriesOk() ([]string, bool) { + if o == nil || IsNil(o.Categories) { + return nil, false + } + return o.Categories, true +} + +// HasCategories returns a boolean if a field has been set. +func (o *Plan) HasCategories() bool { + if o != nil && !IsNil(o.Categories) { + return true + } + + return false +} + +// SetCategories gets a reference to the given []string and assigns it to the Categories field. +func (o *Plan) SetCategories(v []string) { + o.Categories = v +} + +// GetClass returns the Class field value if set, zero value otherwise. +func (o *Plan) GetClass() string { + if o == nil || IsNil(o.Class) { + var ret string + return ret + } + return *o.Class +} + +// GetClassOk returns a tuple with the Class field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetClassOk() (*string, bool) { + if o == nil || IsNil(o.Class) { + return nil, false + } + return o.Class, true +} + +// HasClass returns a boolean if a field has been set. +func (o *Plan) HasClass() bool { + if o != nil && !IsNil(o.Class) { + return true + } + + return false +} + +// SetClass gets a reference to the given string and assigns it to the Class field. +func (o *Plan) SetClass(v string) { + o.Class = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Plan) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Plan) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Plan) SetDescription(v string) { + o.Description = &v +} + +// GetDeploymentTypes returns the DeploymentTypes field value if set, zero value otherwise. +func (o *Plan) GetDeploymentTypes() []PlanDeploymentTypesInner { + if o == nil || IsNil(o.DeploymentTypes) { + var ret []PlanDeploymentTypesInner + return ret + } + return o.DeploymentTypes +} + +// GetDeploymentTypesOk returns a tuple with the DeploymentTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetDeploymentTypesOk() ([]PlanDeploymentTypesInner, bool) { + if o == nil || IsNil(o.DeploymentTypes) { + return nil, false + } + return o.DeploymentTypes, true +} + +// HasDeploymentTypes returns a boolean if a field has been set. +func (o *Plan) HasDeploymentTypes() bool { + if o != nil && !IsNil(o.DeploymentTypes) { + return true + } + + return false +} + +// SetDeploymentTypes gets a reference to the given []PlanDeploymentTypesInner and assigns it to the DeploymentTypes field. +func (o *Plan) SetDeploymentTypes(v []PlanDeploymentTypesInner) { + o.DeploymentTypes = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Plan) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Plan) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Plan) SetId(v string) { + o.Id = &v +} + +// GetLegacy returns the Legacy field value if set, zero value otherwise. +func (o *Plan) GetLegacy() bool { + if o == nil || IsNil(o.Legacy) { + var ret bool + return ret + } + return *o.Legacy +} + +// GetLegacyOk returns a tuple with the Legacy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetLegacyOk() (*bool, bool) { + if o == nil || IsNil(o.Legacy) { + return nil, false + } + return o.Legacy, true +} + +// HasLegacy returns a boolean if a field has been set. +func (o *Plan) HasLegacy() bool { + if o != nil && !IsNil(o.Legacy) { + return true + } + + return false +} + +// SetLegacy gets a reference to the given bool and assigns it to the Legacy field. +func (o *Plan) SetLegacy(v bool) { + o.Legacy = &v +} + +// GetLine returns the Line field value if set, zero value otherwise. +func (o *Plan) GetLine() string { + if o == nil || IsNil(o.Line) { + var ret string + return ret + } + return *o.Line +} + +// GetLineOk returns a tuple with the Line field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetLineOk() (*string, bool) { + if o == nil || IsNil(o.Line) { + return nil, false + } + return o.Line, true +} + +// HasLine returns a boolean if a field has been set. +func (o *Plan) HasLine() bool { + if o != nil && !IsNil(o.Line) { + return true + } + + return false +} + +// SetLine gets a reference to the given string and assigns it to the Line field. +func (o *Plan) SetLine(v string) { + o.Line = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Plan) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Plan) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Plan) SetName(v string) { + o.Name = &v +} + +// GetPricing returns the Pricing field value if set, zero value otherwise. +func (o *Plan) GetPricing() map[string]interface{} { + if o == nil || IsNil(o.Pricing) { + var ret map[string]interface{} + return ret + } + return o.Pricing +} + +// GetPricingOk returns a tuple with the Pricing field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetPricingOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Pricing) { + return map[string]interface{}{}, false + } + return o.Pricing, true +} + +// HasPricing returns a boolean if a field has been set. +func (o *Plan) HasPricing() bool { + if o != nil && !IsNil(o.Pricing) { + return true + } + + return false +} + +// SetPricing gets a reference to the given map[string]interface{} and assigns it to the Pricing field. +func (o *Plan) SetPricing(v map[string]interface{}) { + o.Pricing = v +} + +// GetSlug returns the Slug field value if set, zero value otherwise. +func (o *Plan) GetSlug() string { + if o == nil || IsNil(o.Slug) { + var ret string + return ret + } + return *o.Slug +} + +// GetSlugOk returns a tuple with the Slug field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetSlugOk() (*string, bool) { + if o == nil || IsNil(o.Slug) { + return nil, false + } + return o.Slug, true +} + +// HasSlug returns a boolean if a field has been set. +func (o *Plan) HasSlug() bool { + if o != nil && !IsNil(o.Slug) { + return true + } + + return false +} + +// SetSlug gets a reference to the given string and assigns it to the Slug field. +func (o *Plan) SetSlug(v string) { + o.Slug = &v +} + +// GetSpecs returns the Specs field value if set, zero value otherwise. +func (o *Plan) GetSpecs() PlanSpecs { + if o == nil || IsNil(o.Specs) { + var ret PlanSpecs + return ret + } + return *o.Specs +} + +// GetSpecsOk returns a tuple with the Specs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetSpecsOk() (*PlanSpecs, bool) { + if o == nil || IsNil(o.Specs) { + return nil, false + } + return o.Specs, true +} + +// HasSpecs returns a boolean if a field has been set. +func (o *Plan) HasSpecs() bool { + if o != nil && !IsNil(o.Specs) { + return true + } + + return false +} + +// SetSpecs gets a reference to the given PlanSpecs and assigns it to the Specs field. +func (o *Plan) SetSpecs(v PlanSpecs) { + o.Specs = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Plan) GetType() PlanType { + if o == nil || IsNil(o.Type) { + var ret PlanType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetTypeOk() (*PlanType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Plan) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given PlanType and assigns it to the Type field. +func (o *Plan) SetType(v PlanType) { + o.Type = &v +} + +func (o Plan) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Plan) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AvailableIn) { + toSerialize["available_in"] = o.AvailableIn + } + if !IsNil(o.AvailableInMetros) { + toSerialize["available_in_metros"] = o.AvailableInMetros + } + if !IsNil(o.Categories) { + toSerialize["categories"] = o.Categories + } + if !IsNil(o.Class) { + toSerialize["class"] = o.Class + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DeploymentTypes) { + toSerialize["deployment_types"] = o.DeploymentTypes + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Legacy) { + toSerialize["legacy"] = o.Legacy + } + if !IsNil(o.Line) { + toSerialize["line"] = o.Line + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Pricing) { + toSerialize["pricing"] = o.Pricing + } + if !IsNil(o.Slug) { + toSerialize["slug"] = o.Slug + } + if !IsNil(o.Specs) { + toSerialize["specs"] = o.Specs + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Plan) UnmarshalJSON(data []byte) (err error) { + varPlan := _Plan{} + + err = json.Unmarshal(data, &varPlan) + + if err != nil { + return err + } + + *o = Plan(varPlan) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "available_in") + delete(additionalProperties, "available_in_metros") + delete(additionalProperties, "categories") + delete(additionalProperties, "class") + delete(additionalProperties, "description") + delete(additionalProperties, "deployment_types") + delete(additionalProperties, "id") + delete(additionalProperties, "legacy") + delete(additionalProperties, "line") + delete(additionalProperties, "name") + delete(additionalProperties, "pricing") + delete(additionalProperties, "slug") + delete(additionalProperties, "specs") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlan struct { + value *Plan + isSet bool +} + +func (v NullablePlan) Get() *Plan { + return v.value +} + +func (v *NullablePlan) Set(val *Plan) { + v.value = val + v.isSet = true +} + +func (v NullablePlan) IsSet() bool { + return v.isSet +} + +func (v *NullablePlan) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlan(val *Plan) *NullablePlan { + return &NullablePlan{value: val, isSet: true} +} + +func (v NullablePlan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_inner.go new file mode 100644 index 00000000..7af4a730 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_inner.go @@ -0,0 +1,192 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PlanAvailableInInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanAvailableInInner{} + +// PlanAvailableInInner struct for PlanAvailableInInner +type PlanAvailableInInner struct { + // href to the Facility + Href *string `json:"href,omitempty"` + Price *PlanAvailableInInnerPrice `json:"price,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PlanAvailableInInner PlanAvailableInInner + +// NewPlanAvailableInInner instantiates a new PlanAvailableInInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanAvailableInInner() *PlanAvailableInInner { + this := PlanAvailableInInner{} + return &this +} + +// NewPlanAvailableInInnerWithDefaults instantiates a new PlanAvailableInInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanAvailableInInnerWithDefaults() *PlanAvailableInInner { + this := PlanAvailableInInner{} + return &this +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *PlanAvailableInInner) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanAvailableInInner) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *PlanAvailableInInner) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *PlanAvailableInInner) SetHref(v string) { + o.Href = &v +} + +// GetPrice returns the Price field value if set, zero value otherwise. +func (o *PlanAvailableInInner) GetPrice() PlanAvailableInInnerPrice { + if o == nil || IsNil(o.Price) { + var ret PlanAvailableInInnerPrice + return ret + } + return *o.Price +} + +// GetPriceOk returns a tuple with the Price field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanAvailableInInner) GetPriceOk() (*PlanAvailableInInnerPrice, bool) { + if o == nil || IsNil(o.Price) { + return nil, false + } + return o.Price, true +} + +// HasPrice returns a boolean if a field has been set. +func (o *PlanAvailableInInner) HasPrice() bool { + if o != nil && !IsNil(o.Price) { + return true + } + + return false +} + +// SetPrice gets a reference to the given PlanAvailableInInnerPrice and assigns it to the Price field. +func (o *PlanAvailableInInner) SetPrice(v PlanAvailableInInnerPrice) { + o.Price = &v +} + +func (o PlanAvailableInInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PlanAvailableInInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Price) { + toSerialize["price"] = o.Price + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PlanAvailableInInner) UnmarshalJSON(data []byte) (err error) { + varPlanAvailableInInner := _PlanAvailableInInner{} + + err = json.Unmarshal(data, &varPlanAvailableInInner) + + if err != nil { + return err + } + + *o = PlanAvailableInInner(varPlanAvailableInInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "href") + delete(additionalProperties, "price") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlanAvailableInInner struct { + value *PlanAvailableInInner + isSet bool +} + +func (v NullablePlanAvailableInInner) Get() *PlanAvailableInInner { + return v.value +} + +func (v *NullablePlanAvailableInInner) Set(val *PlanAvailableInInner) { + v.value = val + v.isSet = true +} + +func (v NullablePlanAvailableInInner) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanAvailableInInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanAvailableInInner(val *PlanAvailableInInner) *NullablePlanAvailableInInner { + return &NullablePlanAvailableInInner{value: val, isSet: true} +} + +func (v NullablePlanAvailableInInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanAvailableInInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_inner_price.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_inner_price.go new file mode 100644 index 00000000..fabdb967 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_inner_price.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PlanAvailableInInnerPrice type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanAvailableInInnerPrice{} + +// PlanAvailableInInnerPrice struct for PlanAvailableInInnerPrice +type PlanAvailableInInnerPrice struct { + Hour *float64 `json:"hour,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PlanAvailableInInnerPrice PlanAvailableInInnerPrice + +// NewPlanAvailableInInnerPrice instantiates a new PlanAvailableInInnerPrice object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanAvailableInInnerPrice() *PlanAvailableInInnerPrice { + this := PlanAvailableInInnerPrice{} + return &this +} + +// NewPlanAvailableInInnerPriceWithDefaults instantiates a new PlanAvailableInInnerPrice object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanAvailableInInnerPriceWithDefaults() *PlanAvailableInInnerPrice { + this := PlanAvailableInInnerPrice{} + return &this +} + +// GetHour returns the Hour field value if set, zero value otherwise. +func (o *PlanAvailableInInnerPrice) GetHour() float64 { + if o == nil || IsNil(o.Hour) { + var ret float64 + return ret + } + return *o.Hour +} + +// GetHourOk returns a tuple with the Hour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanAvailableInInnerPrice) GetHourOk() (*float64, bool) { + if o == nil || IsNil(o.Hour) { + return nil, false + } + return o.Hour, true +} + +// HasHour returns a boolean if a field has been set. +func (o *PlanAvailableInInnerPrice) HasHour() bool { + if o != nil && !IsNil(o.Hour) { + return true + } + + return false +} + +// SetHour gets a reference to the given float64 and assigns it to the Hour field. +func (o *PlanAvailableInInnerPrice) SetHour(v float64) { + o.Hour = &v +} + +func (o PlanAvailableInInnerPrice) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PlanAvailableInInnerPrice) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Hour) { + toSerialize["hour"] = o.Hour + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PlanAvailableInInnerPrice) UnmarshalJSON(data []byte) (err error) { + varPlanAvailableInInnerPrice := _PlanAvailableInInnerPrice{} + + err = json.Unmarshal(data, &varPlanAvailableInInnerPrice) + + if err != nil { + return err + } + + *o = PlanAvailableInInnerPrice(varPlanAvailableInInnerPrice) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "hour") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlanAvailableInInnerPrice struct { + value *PlanAvailableInInnerPrice + isSet bool +} + +func (v NullablePlanAvailableInInnerPrice) Get() *PlanAvailableInInnerPrice { + return v.value +} + +func (v *NullablePlanAvailableInInnerPrice) Set(val *PlanAvailableInInnerPrice) { + v.value = val + v.isSet = true +} + +func (v NullablePlanAvailableInInnerPrice) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanAvailableInInnerPrice) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanAvailableInInnerPrice(val *PlanAvailableInInnerPrice) *NullablePlanAvailableInInnerPrice { + return &NullablePlanAvailableInInnerPrice{value: val, isSet: true} +} + +func (v NullablePlanAvailableInInnerPrice) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanAvailableInInnerPrice) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_metros_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_metros_inner.go new file mode 100644 index 00000000..596260d2 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_available_in_metros_inner.go @@ -0,0 +1,192 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PlanAvailableInMetrosInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanAvailableInMetrosInner{} + +// PlanAvailableInMetrosInner struct for PlanAvailableInMetrosInner +type PlanAvailableInMetrosInner struct { + // href to the Metro + Href *string `json:"href,omitempty"` + Price *PlanAvailableInInnerPrice `json:"price,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PlanAvailableInMetrosInner PlanAvailableInMetrosInner + +// NewPlanAvailableInMetrosInner instantiates a new PlanAvailableInMetrosInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanAvailableInMetrosInner() *PlanAvailableInMetrosInner { + this := PlanAvailableInMetrosInner{} + return &this +} + +// NewPlanAvailableInMetrosInnerWithDefaults instantiates a new PlanAvailableInMetrosInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanAvailableInMetrosInnerWithDefaults() *PlanAvailableInMetrosInner { + this := PlanAvailableInMetrosInner{} + return &this +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *PlanAvailableInMetrosInner) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanAvailableInMetrosInner) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *PlanAvailableInMetrosInner) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *PlanAvailableInMetrosInner) SetHref(v string) { + o.Href = &v +} + +// GetPrice returns the Price field value if set, zero value otherwise. +func (o *PlanAvailableInMetrosInner) GetPrice() PlanAvailableInInnerPrice { + if o == nil || IsNil(o.Price) { + var ret PlanAvailableInInnerPrice + return ret + } + return *o.Price +} + +// GetPriceOk returns a tuple with the Price field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanAvailableInMetrosInner) GetPriceOk() (*PlanAvailableInInnerPrice, bool) { + if o == nil || IsNil(o.Price) { + return nil, false + } + return o.Price, true +} + +// HasPrice returns a boolean if a field has been set. +func (o *PlanAvailableInMetrosInner) HasPrice() bool { + if o != nil && !IsNil(o.Price) { + return true + } + + return false +} + +// SetPrice gets a reference to the given PlanAvailableInInnerPrice and assigns it to the Price field. +func (o *PlanAvailableInMetrosInner) SetPrice(v PlanAvailableInInnerPrice) { + o.Price = &v +} + +func (o PlanAvailableInMetrosInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PlanAvailableInMetrosInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Price) { + toSerialize["price"] = o.Price + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PlanAvailableInMetrosInner) UnmarshalJSON(data []byte) (err error) { + varPlanAvailableInMetrosInner := _PlanAvailableInMetrosInner{} + + err = json.Unmarshal(data, &varPlanAvailableInMetrosInner) + + if err != nil { + return err + } + + *o = PlanAvailableInMetrosInner(varPlanAvailableInMetrosInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "href") + delete(additionalProperties, "price") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlanAvailableInMetrosInner struct { + value *PlanAvailableInMetrosInner + isSet bool +} + +func (v NullablePlanAvailableInMetrosInner) Get() *PlanAvailableInMetrosInner { + return v.value +} + +func (v *NullablePlanAvailableInMetrosInner) Set(val *PlanAvailableInMetrosInner) { + v.value = val + v.isSet = true +} + +func (v NullablePlanAvailableInMetrosInner) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanAvailableInMetrosInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanAvailableInMetrosInner(val *PlanAvailableInMetrosInner) *NullablePlanAvailableInMetrosInner { + return &NullablePlanAvailableInMetrosInner{value: val, isSet: true} +} + +func (v NullablePlanAvailableInMetrosInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanAvailableInMetrosInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_deployment_types_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_deployment_types_inner.go new file mode 100644 index 00000000..22cdf3b6 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_deployment_types_inner.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// PlanDeploymentTypesInner the model 'PlanDeploymentTypesInner' +type PlanDeploymentTypesInner string + +// List of Plan_deployment_types_inner +const ( + PLANDEPLOYMENTTYPESINNER_ON_DEMAND PlanDeploymentTypesInner = "on_demand" + PLANDEPLOYMENTTYPESINNER_SPOT_MARKET PlanDeploymentTypesInner = "spot_market" +) + +// All allowed values of PlanDeploymentTypesInner enum +var AllowedPlanDeploymentTypesInnerEnumValues = []PlanDeploymentTypesInner{ + "on_demand", + "spot_market", +} + +func (v *PlanDeploymentTypesInner) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := PlanDeploymentTypesInner(value) + for _, existing := range AllowedPlanDeploymentTypesInnerEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PlanDeploymentTypesInner", value) +} + +// NewPlanDeploymentTypesInnerFromValue returns a pointer to a valid PlanDeploymentTypesInner +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPlanDeploymentTypesInnerFromValue(v string) (*PlanDeploymentTypesInner, error) { + ev := PlanDeploymentTypesInner(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PlanDeploymentTypesInner: valid values are %v", v, AllowedPlanDeploymentTypesInnerEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PlanDeploymentTypesInner) IsValid() bool { + for _, existing := range AllowedPlanDeploymentTypesInnerEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Plan_deployment_types_inner value +func (v PlanDeploymentTypesInner) Ptr() *PlanDeploymentTypesInner { + return &v +} + +type NullablePlanDeploymentTypesInner struct { + value *PlanDeploymentTypesInner + isSet bool +} + +func (v NullablePlanDeploymentTypesInner) Get() *PlanDeploymentTypesInner { + return v.value +} + +func (v *NullablePlanDeploymentTypesInner) Set(val *PlanDeploymentTypesInner) { + v.value = val + v.isSet = true +} + +func (v NullablePlanDeploymentTypesInner) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanDeploymentTypesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanDeploymentTypesInner(val *PlanDeploymentTypesInner) *NullablePlanDeploymentTypesInner { + return &NullablePlanDeploymentTypesInner{value: val, isSet: true} +} + +func (v NullablePlanDeploymentTypesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanDeploymentTypesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_list.go new file mode 100644 index 00000000..4303c030 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PlanList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanList{} + +// PlanList struct for PlanList +type PlanList struct { + Plans []Plan `json:"plans,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PlanList PlanList + +// NewPlanList instantiates a new PlanList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanList() *PlanList { + this := PlanList{} + return &this +} + +// NewPlanListWithDefaults instantiates a new PlanList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanListWithDefaults() *PlanList { + this := PlanList{} + return &this +} + +// GetPlans returns the Plans field value if set, zero value otherwise. +func (o *PlanList) GetPlans() []Plan { + if o == nil || IsNil(o.Plans) { + var ret []Plan + return ret + } + return o.Plans +} + +// GetPlansOk returns a tuple with the Plans field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanList) GetPlansOk() ([]Plan, bool) { + if o == nil || IsNil(o.Plans) { + return nil, false + } + return o.Plans, true +} + +// HasPlans returns a boolean if a field has been set. +func (o *PlanList) HasPlans() bool { + if o != nil && !IsNil(o.Plans) { + return true + } + + return false +} + +// SetPlans gets a reference to the given []Plan and assigns it to the Plans field. +func (o *PlanList) SetPlans(v []Plan) { + o.Plans = v +} + +func (o PlanList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PlanList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Plans) { + toSerialize["plans"] = o.Plans + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PlanList) UnmarshalJSON(data []byte) (err error) { + varPlanList := _PlanList{} + + err = json.Unmarshal(data, &varPlanList) + + if err != nil { + return err + } + + *o = PlanList(varPlanList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "plans") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlanList struct { + value *PlanList + isSet bool +} + +func (v NullablePlanList) Get() *PlanList { + return v.value +} + +func (v *NullablePlanList) Set(val *PlanList) { + v.value = val + v.isSet = true +} + +func (v NullablePlanList) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanList(val *PlanList) *NullablePlanList { + return &NullablePlanList{value: val, isSet: true} +} + +func (v NullablePlanList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs.go new file mode 100644 index 00000000..478d3e85 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs.go @@ -0,0 +1,302 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PlanSpecs type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanSpecs{} + +// PlanSpecs struct for PlanSpecs +type PlanSpecs struct { + Cpus []PlanSpecsCpusInner `json:"cpus,omitempty"` + Memory *PlanSpecsMemory `json:"memory,omitempty"` + Drives []PlanSpecsDrivesInner `json:"drives,omitempty"` + Nics []PlanSpecsNicsInner `json:"nics,omitempty"` + Features *PlanSpecsFeatures `json:"features,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PlanSpecs PlanSpecs + +// NewPlanSpecs instantiates a new PlanSpecs object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanSpecs() *PlanSpecs { + this := PlanSpecs{} + return &this +} + +// NewPlanSpecsWithDefaults instantiates a new PlanSpecs object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanSpecsWithDefaults() *PlanSpecs { + this := PlanSpecs{} + return &this +} + +// GetCpus returns the Cpus field value if set, zero value otherwise. +func (o *PlanSpecs) GetCpus() []PlanSpecsCpusInner { + if o == nil || IsNil(o.Cpus) { + var ret []PlanSpecsCpusInner + return ret + } + return o.Cpus +} + +// GetCpusOk returns a tuple with the Cpus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecs) GetCpusOk() ([]PlanSpecsCpusInner, bool) { + if o == nil || IsNil(o.Cpus) { + return nil, false + } + return o.Cpus, true +} + +// HasCpus returns a boolean if a field has been set. +func (o *PlanSpecs) HasCpus() bool { + if o != nil && !IsNil(o.Cpus) { + return true + } + + return false +} + +// SetCpus gets a reference to the given []PlanSpecsCpusInner and assigns it to the Cpus field. +func (o *PlanSpecs) SetCpus(v []PlanSpecsCpusInner) { + o.Cpus = v +} + +// GetMemory returns the Memory field value if set, zero value otherwise. +func (o *PlanSpecs) GetMemory() PlanSpecsMemory { + if o == nil || IsNil(o.Memory) { + var ret PlanSpecsMemory + return ret + } + return *o.Memory +} + +// GetMemoryOk returns a tuple with the Memory field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecs) GetMemoryOk() (*PlanSpecsMemory, bool) { + if o == nil || IsNil(o.Memory) { + return nil, false + } + return o.Memory, true +} + +// HasMemory returns a boolean if a field has been set. +func (o *PlanSpecs) HasMemory() bool { + if o != nil && !IsNil(o.Memory) { + return true + } + + return false +} + +// SetMemory gets a reference to the given PlanSpecsMemory and assigns it to the Memory field. +func (o *PlanSpecs) SetMemory(v PlanSpecsMemory) { + o.Memory = &v +} + +// GetDrives returns the Drives field value if set, zero value otherwise. +func (o *PlanSpecs) GetDrives() []PlanSpecsDrivesInner { + if o == nil || IsNil(o.Drives) { + var ret []PlanSpecsDrivesInner + return ret + } + return o.Drives +} + +// GetDrivesOk returns a tuple with the Drives field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecs) GetDrivesOk() ([]PlanSpecsDrivesInner, bool) { + if o == nil || IsNil(o.Drives) { + return nil, false + } + return o.Drives, true +} + +// HasDrives returns a boolean if a field has been set. +func (o *PlanSpecs) HasDrives() bool { + if o != nil && !IsNil(o.Drives) { + return true + } + + return false +} + +// SetDrives gets a reference to the given []PlanSpecsDrivesInner and assigns it to the Drives field. +func (o *PlanSpecs) SetDrives(v []PlanSpecsDrivesInner) { + o.Drives = v +} + +// GetNics returns the Nics field value if set, zero value otherwise. +func (o *PlanSpecs) GetNics() []PlanSpecsNicsInner { + if o == nil || IsNil(o.Nics) { + var ret []PlanSpecsNicsInner + return ret + } + return o.Nics +} + +// GetNicsOk returns a tuple with the Nics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecs) GetNicsOk() ([]PlanSpecsNicsInner, bool) { + if o == nil || IsNil(o.Nics) { + return nil, false + } + return o.Nics, true +} + +// HasNics returns a boolean if a field has been set. +func (o *PlanSpecs) HasNics() bool { + if o != nil && !IsNil(o.Nics) { + return true + } + + return false +} + +// SetNics gets a reference to the given []PlanSpecsNicsInner and assigns it to the Nics field. +func (o *PlanSpecs) SetNics(v []PlanSpecsNicsInner) { + o.Nics = v +} + +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *PlanSpecs) GetFeatures() PlanSpecsFeatures { + if o == nil || IsNil(o.Features) { + var ret PlanSpecsFeatures + return ret + } + return *o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecs) GetFeaturesOk() (*PlanSpecsFeatures, bool) { + if o == nil || IsNil(o.Features) { + return nil, false + } + return o.Features, true +} + +// HasFeatures returns a boolean if a field has been set. +func (o *PlanSpecs) HasFeatures() bool { + if o != nil && !IsNil(o.Features) { + return true + } + + return false +} + +// SetFeatures gets a reference to the given PlanSpecsFeatures and assigns it to the Features field. +func (o *PlanSpecs) SetFeatures(v PlanSpecsFeatures) { + o.Features = &v +} + +func (o PlanSpecs) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PlanSpecs) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Cpus) { + toSerialize["cpus"] = o.Cpus + } + if !IsNil(o.Memory) { + toSerialize["memory"] = o.Memory + } + if !IsNil(o.Drives) { + toSerialize["drives"] = o.Drives + } + if !IsNil(o.Nics) { + toSerialize["nics"] = o.Nics + } + if !IsNil(o.Features) { + toSerialize["features"] = o.Features + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PlanSpecs) UnmarshalJSON(data []byte) (err error) { + varPlanSpecs := _PlanSpecs{} + + err = json.Unmarshal(data, &varPlanSpecs) + + if err != nil { + return err + } + + *o = PlanSpecs(varPlanSpecs) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cpus") + delete(additionalProperties, "memory") + delete(additionalProperties, "drives") + delete(additionalProperties, "nics") + delete(additionalProperties, "features") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlanSpecs struct { + value *PlanSpecs + isSet bool +} + +func (v NullablePlanSpecs) Get() *PlanSpecs { + return v.value +} + +func (v *NullablePlanSpecs) Set(val *PlanSpecs) { + v.value = val + v.isSet = true +} + +func (v NullablePlanSpecs) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanSpecs) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanSpecs(val *PlanSpecs) *NullablePlanSpecs { + return &NullablePlanSpecs{value: val, isSet: true} +} + +func (v NullablePlanSpecs) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanSpecs) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_cpus_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_cpus_inner.go new file mode 100644 index 00000000..6d61079b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_cpus_inner.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PlanSpecsCpusInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanSpecsCpusInner{} + +// PlanSpecsCpusInner struct for PlanSpecsCpusInner +type PlanSpecsCpusInner struct { + Count *int32 `json:"count,omitempty"` + Type *string `json:"type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PlanSpecsCpusInner PlanSpecsCpusInner + +// NewPlanSpecsCpusInner instantiates a new PlanSpecsCpusInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanSpecsCpusInner() *PlanSpecsCpusInner { + this := PlanSpecsCpusInner{} + return &this +} + +// NewPlanSpecsCpusInnerWithDefaults instantiates a new PlanSpecsCpusInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanSpecsCpusInnerWithDefaults() *PlanSpecsCpusInner { + this := PlanSpecsCpusInner{} + return &this +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *PlanSpecsCpusInner) GetCount() int32 { + if o == nil || IsNil(o.Count) { + var ret int32 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsCpusInner) GetCountOk() (*int32, bool) { + if o == nil || IsNil(o.Count) { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *PlanSpecsCpusInner) HasCount() bool { + if o != nil && !IsNil(o.Count) { + return true + } + + return false +} + +// SetCount gets a reference to the given int32 and assigns it to the Count field. +func (o *PlanSpecsCpusInner) SetCount(v int32) { + o.Count = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *PlanSpecsCpusInner) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsCpusInner) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *PlanSpecsCpusInner) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *PlanSpecsCpusInner) SetType(v string) { + o.Type = &v +} + +func (o PlanSpecsCpusInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PlanSpecsCpusInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Count) { + toSerialize["count"] = o.Count + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PlanSpecsCpusInner) UnmarshalJSON(data []byte) (err error) { + varPlanSpecsCpusInner := _PlanSpecsCpusInner{} + + err = json.Unmarshal(data, &varPlanSpecsCpusInner) + + if err != nil { + return err + } + + *o = PlanSpecsCpusInner(varPlanSpecsCpusInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "count") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlanSpecsCpusInner struct { + value *PlanSpecsCpusInner + isSet bool +} + +func (v NullablePlanSpecsCpusInner) Get() *PlanSpecsCpusInner { + return v.value +} + +func (v *NullablePlanSpecsCpusInner) Set(val *PlanSpecsCpusInner) { + v.value = val + v.isSet = true +} + +func (v NullablePlanSpecsCpusInner) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanSpecsCpusInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanSpecsCpusInner(val *PlanSpecsCpusInner) *NullablePlanSpecsCpusInner { + return &NullablePlanSpecsCpusInner{value: val, isSet: true} +} + +func (v NullablePlanSpecsCpusInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanSpecsCpusInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_drives_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_drives_inner.go new file mode 100644 index 00000000..c654ba3c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_drives_inner.go @@ -0,0 +1,265 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PlanSpecsDrivesInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanSpecsDrivesInner{} + +// PlanSpecsDrivesInner struct for PlanSpecsDrivesInner +type PlanSpecsDrivesInner struct { + Count *int32 `json:"count,omitempty"` + Type *string `json:"type,omitempty"` + Size *string `json:"size,omitempty"` + Category *PlanSpecsDrivesInnerCategory `json:"category,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PlanSpecsDrivesInner PlanSpecsDrivesInner + +// NewPlanSpecsDrivesInner instantiates a new PlanSpecsDrivesInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanSpecsDrivesInner() *PlanSpecsDrivesInner { + this := PlanSpecsDrivesInner{} + return &this +} + +// NewPlanSpecsDrivesInnerWithDefaults instantiates a new PlanSpecsDrivesInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanSpecsDrivesInnerWithDefaults() *PlanSpecsDrivesInner { + this := PlanSpecsDrivesInner{} + return &this +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *PlanSpecsDrivesInner) GetCount() int32 { + if o == nil || IsNil(o.Count) { + var ret int32 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsDrivesInner) GetCountOk() (*int32, bool) { + if o == nil || IsNil(o.Count) { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *PlanSpecsDrivesInner) HasCount() bool { + if o != nil && !IsNil(o.Count) { + return true + } + + return false +} + +// SetCount gets a reference to the given int32 and assigns it to the Count field. +func (o *PlanSpecsDrivesInner) SetCount(v int32) { + o.Count = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *PlanSpecsDrivesInner) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsDrivesInner) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *PlanSpecsDrivesInner) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *PlanSpecsDrivesInner) SetType(v string) { + o.Type = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *PlanSpecsDrivesInner) GetSize() string { + if o == nil || IsNil(o.Size) { + var ret string + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsDrivesInner) GetSizeOk() (*string, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *PlanSpecsDrivesInner) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given string and assigns it to the Size field. +func (o *PlanSpecsDrivesInner) SetSize(v string) { + o.Size = &v +} + +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *PlanSpecsDrivesInner) GetCategory() PlanSpecsDrivesInnerCategory { + if o == nil || IsNil(o.Category) { + var ret PlanSpecsDrivesInnerCategory + return ret + } + return *o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsDrivesInner) GetCategoryOk() (*PlanSpecsDrivesInnerCategory, bool) { + if o == nil || IsNil(o.Category) { + return nil, false + } + return o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *PlanSpecsDrivesInner) HasCategory() bool { + if o != nil && !IsNil(o.Category) { + return true + } + + return false +} + +// SetCategory gets a reference to the given PlanSpecsDrivesInnerCategory and assigns it to the Category field. +func (o *PlanSpecsDrivesInner) SetCategory(v PlanSpecsDrivesInnerCategory) { + o.Category = &v +} + +func (o PlanSpecsDrivesInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PlanSpecsDrivesInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Count) { + toSerialize["count"] = o.Count + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.Category) { + toSerialize["category"] = o.Category + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PlanSpecsDrivesInner) UnmarshalJSON(data []byte) (err error) { + varPlanSpecsDrivesInner := _PlanSpecsDrivesInner{} + + err = json.Unmarshal(data, &varPlanSpecsDrivesInner) + + if err != nil { + return err + } + + *o = PlanSpecsDrivesInner(varPlanSpecsDrivesInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "count") + delete(additionalProperties, "type") + delete(additionalProperties, "size") + delete(additionalProperties, "category") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlanSpecsDrivesInner struct { + value *PlanSpecsDrivesInner + isSet bool +} + +func (v NullablePlanSpecsDrivesInner) Get() *PlanSpecsDrivesInner { + return v.value +} + +func (v *NullablePlanSpecsDrivesInner) Set(val *PlanSpecsDrivesInner) { + v.value = val + v.isSet = true +} + +func (v NullablePlanSpecsDrivesInner) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanSpecsDrivesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanSpecsDrivesInner(val *PlanSpecsDrivesInner) *NullablePlanSpecsDrivesInner { + return &NullablePlanSpecsDrivesInner{value: val, isSet: true} +} + +func (v NullablePlanSpecsDrivesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanSpecsDrivesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_drives_inner_category.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_drives_inner_category.go new file mode 100644 index 00000000..7aeaef81 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_drives_inner_category.go @@ -0,0 +1,113 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// PlanSpecsDrivesInnerCategory the model 'PlanSpecsDrivesInnerCategory' +type PlanSpecsDrivesInnerCategory string + +// List of Plan_specs_drives_inner_category +const ( + PLANSPECSDRIVESINNERCATEGORY_BOOT PlanSpecsDrivesInnerCategory = "boot" + PLANSPECSDRIVESINNERCATEGORY_CACHE PlanSpecsDrivesInnerCategory = "cache" + PLANSPECSDRIVESINNERCATEGORY_STORAGE PlanSpecsDrivesInnerCategory = "storage" +) + +// All allowed values of PlanSpecsDrivesInnerCategory enum +var AllowedPlanSpecsDrivesInnerCategoryEnumValues = []PlanSpecsDrivesInnerCategory{ + "boot", + "cache", + "storage", +} + +func (v *PlanSpecsDrivesInnerCategory) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := PlanSpecsDrivesInnerCategory(value) + for _, existing := range AllowedPlanSpecsDrivesInnerCategoryEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PlanSpecsDrivesInnerCategory", value) +} + +// NewPlanSpecsDrivesInnerCategoryFromValue returns a pointer to a valid PlanSpecsDrivesInnerCategory +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPlanSpecsDrivesInnerCategoryFromValue(v string) (*PlanSpecsDrivesInnerCategory, error) { + ev := PlanSpecsDrivesInnerCategory(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PlanSpecsDrivesInnerCategory: valid values are %v", v, AllowedPlanSpecsDrivesInnerCategoryEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PlanSpecsDrivesInnerCategory) IsValid() bool { + for _, existing := range AllowedPlanSpecsDrivesInnerCategoryEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Plan_specs_drives_inner_category value +func (v PlanSpecsDrivesInnerCategory) Ptr() *PlanSpecsDrivesInnerCategory { + return &v +} + +type NullablePlanSpecsDrivesInnerCategory struct { + value *PlanSpecsDrivesInnerCategory + isSet bool +} + +func (v NullablePlanSpecsDrivesInnerCategory) Get() *PlanSpecsDrivesInnerCategory { + return v.value +} + +func (v *NullablePlanSpecsDrivesInnerCategory) Set(val *PlanSpecsDrivesInnerCategory) { + v.value = val + v.isSet = true +} + +func (v NullablePlanSpecsDrivesInnerCategory) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanSpecsDrivesInnerCategory) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanSpecsDrivesInnerCategory(val *PlanSpecsDrivesInnerCategory) *NullablePlanSpecsDrivesInnerCategory { + return &NullablePlanSpecsDrivesInnerCategory{value: val, isSet: true} +} + +func (v NullablePlanSpecsDrivesInnerCategory) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanSpecsDrivesInnerCategory) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_features.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_features.go new file mode 100644 index 00000000..c50c9fcb --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_features.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PlanSpecsFeatures type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanSpecsFeatures{} + +// PlanSpecsFeatures struct for PlanSpecsFeatures +type PlanSpecsFeatures struct { + Raid *bool `json:"raid,omitempty"` + Txt *bool `json:"txt,omitempty"` + Uefi *bool `json:"uefi,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PlanSpecsFeatures PlanSpecsFeatures + +// NewPlanSpecsFeatures instantiates a new PlanSpecsFeatures object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanSpecsFeatures() *PlanSpecsFeatures { + this := PlanSpecsFeatures{} + return &this +} + +// NewPlanSpecsFeaturesWithDefaults instantiates a new PlanSpecsFeatures object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanSpecsFeaturesWithDefaults() *PlanSpecsFeatures { + this := PlanSpecsFeatures{} + return &this +} + +// GetRaid returns the Raid field value if set, zero value otherwise. +func (o *PlanSpecsFeatures) GetRaid() bool { + if o == nil || IsNil(o.Raid) { + var ret bool + return ret + } + return *o.Raid +} + +// GetRaidOk returns a tuple with the Raid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsFeatures) GetRaidOk() (*bool, bool) { + if o == nil || IsNil(o.Raid) { + return nil, false + } + return o.Raid, true +} + +// HasRaid returns a boolean if a field has been set. +func (o *PlanSpecsFeatures) HasRaid() bool { + if o != nil && !IsNil(o.Raid) { + return true + } + + return false +} + +// SetRaid gets a reference to the given bool and assigns it to the Raid field. +func (o *PlanSpecsFeatures) SetRaid(v bool) { + o.Raid = &v +} + +// GetTxt returns the Txt field value if set, zero value otherwise. +func (o *PlanSpecsFeatures) GetTxt() bool { + if o == nil || IsNil(o.Txt) { + var ret bool + return ret + } + return *o.Txt +} + +// GetTxtOk returns a tuple with the Txt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsFeatures) GetTxtOk() (*bool, bool) { + if o == nil || IsNil(o.Txt) { + return nil, false + } + return o.Txt, true +} + +// HasTxt returns a boolean if a field has been set. +func (o *PlanSpecsFeatures) HasTxt() bool { + if o != nil && !IsNil(o.Txt) { + return true + } + + return false +} + +// SetTxt gets a reference to the given bool and assigns it to the Txt field. +func (o *PlanSpecsFeatures) SetTxt(v bool) { + o.Txt = &v +} + +// GetUefi returns the Uefi field value if set, zero value otherwise. +func (o *PlanSpecsFeatures) GetUefi() bool { + if o == nil || IsNil(o.Uefi) { + var ret bool + return ret + } + return *o.Uefi +} + +// GetUefiOk returns a tuple with the Uefi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsFeatures) GetUefiOk() (*bool, bool) { + if o == nil || IsNil(o.Uefi) { + return nil, false + } + return o.Uefi, true +} + +// HasUefi returns a boolean if a field has been set. +func (o *PlanSpecsFeatures) HasUefi() bool { + if o != nil && !IsNil(o.Uefi) { + return true + } + + return false +} + +// SetUefi gets a reference to the given bool and assigns it to the Uefi field. +func (o *PlanSpecsFeatures) SetUefi(v bool) { + o.Uefi = &v +} + +func (o PlanSpecsFeatures) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PlanSpecsFeatures) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Raid) { + toSerialize["raid"] = o.Raid + } + if !IsNil(o.Txt) { + toSerialize["txt"] = o.Txt + } + if !IsNil(o.Uefi) { + toSerialize["uefi"] = o.Uefi + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PlanSpecsFeatures) UnmarshalJSON(data []byte) (err error) { + varPlanSpecsFeatures := _PlanSpecsFeatures{} + + err = json.Unmarshal(data, &varPlanSpecsFeatures) + + if err != nil { + return err + } + + *o = PlanSpecsFeatures(varPlanSpecsFeatures) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "raid") + delete(additionalProperties, "txt") + delete(additionalProperties, "uefi") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlanSpecsFeatures struct { + value *PlanSpecsFeatures + isSet bool +} + +func (v NullablePlanSpecsFeatures) Get() *PlanSpecsFeatures { + return v.value +} + +func (v *NullablePlanSpecsFeatures) Set(val *PlanSpecsFeatures) { + v.value = val + v.isSet = true +} + +func (v NullablePlanSpecsFeatures) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanSpecsFeatures) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanSpecsFeatures(val *PlanSpecsFeatures) *NullablePlanSpecsFeatures { + return &NullablePlanSpecsFeatures{value: val, isSet: true} +} + +func (v NullablePlanSpecsFeatures) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanSpecsFeatures) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_memory.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_memory.go new file mode 100644 index 00000000..d07a2751 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_memory.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PlanSpecsMemory type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanSpecsMemory{} + +// PlanSpecsMemory struct for PlanSpecsMemory +type PlanSpecsMemory struct { + Total *string `json:"total,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PlanSpecsMemory PlanSpecsMemory + +// NewPlanSpecsMemory instantiates a new PlanSpecsMemory object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanSpecsMemory() *PlanSpecsMemory { + this := PlanSpecsMemory{} + return &this +} + +// NewPlanSpecsMemoryWithDefaults instantiates a new PlanSpecsMemory object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanSpecsMemoryWithDefaults() *PlanSpecsMemory { + this := PlanSpecsMemory{} + return &this +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *PlanSpecsMemory) GetTotal() string { + if o == nil || IsNil(o.Total) { + var ret string + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsMemory) GetTotalOk() (*string, bool) { + if o == nil || IsNil(o.Total) { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *PlanSpecsMemory) HasTotal() bool { + if o != nil && !IsNil(o.Total) { + return true + } + + return false +} + +// SetTotal gets a reference to the given string and assigns it to the Total field. +func (o *PlanSpecsMemory) SetTotal(v string) { + o.Total = &v +} + +func (o PlanSpecsMemory) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PlanSpecsMemory) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Total) { + toSerialize["total"] = o.Total + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PlanSpecsMemory) UnmarshalJSON(data []byte) (err error) { + varPlanSpecsMemory := _PlanSpecsMemory{} + + err = json.Unmarshal(data, &varPlanSpecsMemory) + + if err != nil { + return err + } + + *o = PlanSpecsMemory(varPlanSpecsMemory) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "total") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlanSpecsMemory struct { + value *PlanSpecsMemory + isSet bool +} + +func (v NullablePlanSpecsMemory) Get() *PlanSpecsMemory { + return v.value +} + +func (v *NullablePlanSpecsMemory) Set(val *PlanSpecsMemory) { + v.value = val + v.isSet = true +} + +func (v NullablePlanSpecsMemory) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanSpecsMemory) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanSpecsMemory(val *PlanSpecsMemory) *NullablePlanSpecsMemory { + return &NullablePlanSpecsMemory{value: val, isSet: true} +} + +func (v NullablePlanSpecsMemory) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanSpecsMemory) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_nics_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_nics_inner.go new file mode 100644 index 00000000..ca963b71 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_specs_nics_inner.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PlanSpecsNicsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanSpecsNicsInner{} + +// PlanSpecsNicsInner struct for PlanSpecsNicsInner +type PlanSpecsNicsInner struct { + Count *int32 `json:"count,omitempty"` + Type *string `json:"type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PlanSpecsNicsInner PlanSpecsNicsInner + +// NewPlanSpecsNicsInner instantiates a new PlanSpecsNicsInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanSpecsNicsInner() *PlanSpecsNicsInner { + this := PlanSpecsNicsInner{} + return &this +} + +// NewPlanSpecsNicsInnerWithDefaults instantiates a new PlanSpecsNicsInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanSpecsNicsInnerWithDefaults() *PlanSpecsNicsInner { + this := PlanSpecsNicsInner{} + return &this +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *PlanSpecsNicsInner) GetCount() int32 { + if o == nil || IsNil(o.Count) { + var ret int32 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsNicsInner) GetCountOk() (*int32, bool) { + if o == nil || IsNil(o.Count) { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *PlanSpecsNicsInner) HasCount() bool { + if o != nil && !IsNil(o.Count) { + return true + } + + return false +} + +// SetCount gets a reference to the given int32 and assigns it to the Count field. +func (o *PlanSpecsNicsInner) SetCount(v int32) { + o.Count = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *PlanSpecsNicsInner) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanSpecsNicsInner) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *PlanSpecsNicsInner) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *PlanSpecsNicsInner) SetType(v string) { + o.Type = &v +} + +func (o PlanSpecsNicsInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PlanSpecsNicsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Count) { + toSerialize["count"] = o.Count + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PlanSpecsNicsInner) UnmarshalJSON(data []byte) (err error) { + varPlanSpecsNicsInner := _PlanSpecsNicsInner{} + + err = json.Unmarshal(data, &varPlanSpecsNicsInner) + + if err != nil { + return err + } + + *o = PlanSpecsNicsInner(varPlanSpecsNicsInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "count") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlanSpecsNicsInner struct { + value *PlanSpecsNicsInner + isSet bool +} + +func (v NullablePlanSpecsNicsInner) Get() *PlanSpecsNicsInner { + return v.value +} + +func (v *NullablePlanSpecsNicsInner) Set(val *PlanSpecsNicsInner) { + v.value = val + v.isSet = true +} + +func (v NullablePlanSpecsNicsInner) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanSpecsNicsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanSpecsNicsInner(val *PlanSpecsNicsInner) *NullablePlanSpecsNicsInner { + return &NullablePlanSpecsNicsInner{value: val, isSet: true} +} + +func (v NullablePlanSpecsNicsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanSpecsNicsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_type.go new file mode 100644 index 00000000..ecf64791 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_plan_type.go @@ -0,0 +1,113 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// PlanType The plan type +type PlanType string + +// List of Plan_type +const ( + PLANTYPE_STANDARD PlanType = "standard" + PLANTYPE_WORKLOAD_OPTIMIZED PlanType = "workload_optimized" + PLANTYPE_CUSTOM PlanType = "custom" +) + +// All allowed values of PlanType enum +var AllowedPlanTypeEnumValues = []PlanType{ + "standard", + "workload_optimized", + "custom", +} + +func (v *PlanType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := PlanType(value) + for _, existing := range AllowedPlanTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PlanType", value) +} + +// NewPlanTypeFromValue returns a pointer to a valid PlanType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPlanTypeFromValue(v string) (*PlanType, error) { + ev := PlanType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PlanType: valid values are %v", v, AllowedPlanTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PlanType) IsValid() bool { + for _, existing := range AllowedPlanTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Plan_type value +func (v PlanType) Ptr() *PlanType { + return &v +} + +type NullablePlanType struct { + value *PlanType + isSet bool +} + +func (v NullablePlanType) Get() *PlanType { + return v.value +} + +func (v *NullablePlanType) Set(val *PlanType) { + v.value = val + v.isSet = true +} + +func (v NullablePlanType) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanType(val *PlanType) *NullablePlanType { + return &NullablePlanType{value: val, isSet: true} +} + +func (v NullablePlanType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port.go new file mode 100644 index 00000000..056e2615 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port.go @@ -0,0 +1,488 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Port type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Port{} + +// Port Port is a hardware port associated with a reserved or instantiated hardware device. +type Port struct { + Bond *BondPortData `json:"bond,omitempty"` + Data *PortData `json:"data,omitempty"` + // Indicates whether or not the bond can be broken on the port (when applicable). + DisbondOperationSupported *bool `json:"disbond_operation_supported,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *PortType `json:"type,omitempty"` + NetworkType *PortNetworkType `json:"network_type,omitempty"` + NativeVirtualNetwork *VirtualNetwork `json:"native_virtual_network,omitempty"` + VirtualNetworks []Href `json:"virtual_networks,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Port Port + +// NewPort instantiates a new Port object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPort() *Port { + this := Port{} + return &this +} + +// NewPortWithDefaults instantiates a new Port object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortWithDefaults() *Port { + this := Port{} + return &this +} + +// GetBond returns the Bond field value if set, zero value otherwise. +func (o *Port) GetBond() BondPortData { + if o == nil || IsNil(o.Bond) { + var ret BondPortData + return ret + } + return *o.Bond +} + +// GetBondOk returns a tuple with the Bond field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Port) GetBondOk() (*BondPortData, bool) { + if o == nil || IsNil(o.Bond) { + return nil, false + } + return o.Bond, true +} + +// HasBond returns a boolean if a field has been set. +func (o *Port) HasBond() bool { + if o != nil && !IsNil(o.Bond) { + return true + } + + return false +} + +// SetBond gets a reference to the given BondPortData and assigns it to the Bond field. +func (o *Port) SetBond(v BondPortData) { + o.Bond = &v +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *Port) GetData() PortData { + if o == nil || IsNil(o.Data) { + var ret PortData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Port) GetDataOk() (*PortData, bool) { + if o == nil || IsNil(o.Data) { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *Port) HasData() bool { + if o != nil && !IsNil(o.Data) { + return true + } + + return false +} + +// SetData gets a reference to the given PortData and assigns it to the Data field. +func (o *Port) SetData(v PortData) { + o.Data = &v +} + +// GetDisbondOperationSupported returns the DisbondOperationSupported field value if set, zero value otherwise. +func (o *Port) GetDisbondOperationSupported() bool { + if o == nil || IsNil(o.DisbondOperationSupported) { + var ret bool + return ret + } + return *o.DisbondOperationSupported +} + +// GetDisbondOperationSupportedOk returns a tuple with the DisbondOperationSupported field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Port) GetDisbondOperationSupportedOk() (*bool, bool) { + if o == nil || IsNil(o.DisbondOperationSupported) { + return nil, false + } + return o.DisbondOperationSupported, true +} + +// HasDisbondOperationSupported returns a boolean if a field has been set. +func (o *Port) HasDisbondOperationSupported() bool { + if o != nil && !IsNil(o.DisbondOperationSupported) { + return true + } + + return false +} + +// SetDisbondOperationSupported gets a reference to the given bool and assigns it to the DisbondOperationSupported field. +func (o *Port) SetDisbondOperationSupported(v bool) { + o.DisbondOperationSupported = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Port) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Port) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *Port) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Port) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Port) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Port) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Port) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Port) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Port) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Port) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Port) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Port) SetName(v string) { + o.Name = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Port) GetType() PortType { + if o == nil || IsNil(o.Type) { + var ret PortType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Port) GetTypeOk() (*PortType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Port) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given PortType and assigns it to the Type field. +func (o *Port) SetType(v PortType) { + o.Type = &v +} + +// GetNetworkType returns the NetworkType field value if set, zero value otherwise. +func (o *Port) GetNetworkType() PortNetworkType { + if o == nil || IsNil(o.NetworkType) { + var ret PortNetworkType + return ret + } + return *o.NetworkType +} + +// GetNetworkTypeOk returns a tuple with the NetworkType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Port) GetNetworkTypeOk() (*PortNetworkType, bool) { + if o == nil || IsNil(o.NetworkType) { + return nil, false + } + return o.NetworkType, true +} + +// HasNetworkType returns a boolean if a field has been set. +func (o *Port) HasNetworkType() bool { + if o != nil && !IsNil(o.NetworkType) { + return true + } + + return false +} + +// SetNetworkType gets a reference to the given PortNetworkType and assigns it to the NetworkType field. +func (o *Port) SetNetworkType(v PortNetworkType) { + o.NetworkType = &v +} + +// GetNativeVirtualNetwork returns the NativeVirtualNetwork field value if set, zero value otherwise. +func (o *Port) GetNativeVirtualNetwork() VirtualNetwork { + if o == nil || IsNil(o.NativeVirtualNetwork) { + var ret VirtualNetwork + return ret + } + return *o.NativeVirtualNetwork +} + +// GetNativeVirtualNetworkOk returns a tuple with the NativeVirtualNetwork field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Port) GetNativeVirtualNetworkOk() (*VirtualNetwork, bool) { + if o == nil || IsNil(o.NativeVirtualNetwork) { + return nil, false + } + return o.NativeVirtualNetwork, true +} + +// HasNativeVirtualNetwork returns a boolean if a field has been set. +func (o *Port) HasNativeVirtualNetwork() bool { + if o != nil && !IsNil(o.NativeVirtualNetwork) { + return true + } + + return false +} + +// SetNativeVirtualNetwork gets a reference to the given VirtualNetwork and assigns it to the NativeVirtualNetwork field. +func (o *Port) SetNativeVirtualNetwork(v VirtualNetwork) { + o.NativeVirtualNetwork = &v +} + +// GetVirtualNetworks returns the VirtualNetworks field value if set, zero value otherwise. +func (o *Port) GetVirtualNetworks() []Href { + if o == nil || IsNil(o.VirtualNetworks) { + var ret []Href + return ret + } + return o.VirtualNetworks +} + +// GetVirtualNetworksOk returns a tuple with the VirtualNetworks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Port) GetVirtualNetworksOk() ([]Href, bool) { + if o == nil || IsNil(o.VirtualNetworks) { + return nil, false + } + return o.VirtualNetworks, true +} + +// HasVirtualNetworks returns a boolean if a field has been set. +func (o *Port) HasVirtualNetworks() bool { + if o != nil && !IsNil(o.VirtualNetworks) { + return true + } + + return false +} + +// SetVirtualNetworks gets a reference to the given []Href and assigns it to the VirtualNetworks field. +func (o *Port) SetVirtualNetworks(v []Href) { + o.VirtualNetworks = v +} + +func (o Port) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Port) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Bond) { + toSerialize["bond"] = o.Bond + } + if !IsNil(o.Data) { + toSerialize["data"] = o.Data + } + if !IsNil(o.DisbondOperationSupported) { + toSerialize["disbond_operation_supported"] = o.DisbondOperationSupported + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.NetworkType) { + toSerialize["network_type"] = o.NetworkType + } + if !IsNil(o.NativeVirtualNetwork) { + toSerialize["native_virtual_network"] = o.NativeVirtualNetwork + } + if !IsNil(o.VirtualNetworks) { + toSerialize["virtual_networks"] = o.VirtualNetworks + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Port) UnmarshalJSON(data []byte) (err error) { + varPort := _Port{} + + err = json.Unmarshal(data, &varPort) + + if err != nil { + return err + } + + *o = Port(varPort) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bond") + delete(additionalProperties, "data") + delete(additionalProperties, "disbond_operation_supported") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "type") + delete(additionalProperties, "network_type") + delete(additionalProperties, "native_virtual_network") + delete(additionalProperties, "virtual_networks") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePort struct { + value *Port + isSet bool +} + +func (v NullablePort) Get() *Port { + return v.value +} + +func (v *NullablePort) Set(val *Port) { + v.value = val + v.isSet = true +} + +func (v NullablePort) IsSet() bool { + return v.isSet +} + +func (v *NullablePort) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePort(val *Port) *NullablePort { + return &NullablePort{value: val, isSet: true} +} + +func (v NullablePort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_assign_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_assign_input.go new file mode 100644 index 00000000..a6a703b4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_assign_input.go @@ -0,0 +1,155 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PortAssignInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortAssignInput{} + +// PortAssignInput struct for PortAssignInput +type PortAssignInput struct { + // Virtual Network ID. May be the UUID of the Virtual Network record, or the VLAN value itself. + Vnid *string `json:"vnid,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PortAssignInput PortAssignInput + +// NewPortAssignInput instantiates a new PortAssignInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortAssignInput() *PortAssignInput { + this := PortAssignInput{} + return &this +} + +// NewPortAssignInputWithDefaults instantiates a new PortAssignInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortAssignInputWithDefaults() *PortAssignInput { + this := PortAssignInput{} + return &this +} + +// GetVnid returns the Vnid field value if set, zero value otherwise. +func (o *PortAssignInput) GetVnid() string { + if o == nil || IsNil(o.Vnid) { + var ret string + return ret + } + return *o.Vnid +} + +// GetVnidOk returns a tuple with the Vnid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortAssignInput) GetVnidOk() (*string, bool) { + if o == nil || IsNil(o.Vnid) { + return nil, false + } + return o.Vnid, true +} + +// HasVnid returns a boolean if a field has been set. +func (o *PortAssignInput) HasVnid() bool { + if o != nil && !IsNil(o.Vnid) { + return true + } + + return false +} + +// SetVnid gets a reference to the given string and assigns it to the Vnid field. +func (o *PortAssignInput) SetVnid(v string) { + o.Vnid = &v +} + +func (o PortAssignInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortAssignInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Vnid) { + toSerialize["vnid"] = o.Vnid + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortAssignInput) UnmarshalJSON(data []byte) (err error) { + varPortAssignInput := _PortAssignInput{} + + err = json.Unmarshal(data, &varPortAssignInput) + + if err != nil { + return err + } + + *o = PortAssignInput(varPortAssignInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "vnid") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortAssignInput struct { + value *PortAssignInput + isSet bool +} + +func (v NullablePortAssignInput) Get() *PortAssignInput { + return v.value +} + +func (v *NullablePortAssignInput) Set(val *PortAssignInput) { + v.value = val + v.isSet = true +} + +func (v NullablePortAssignInput) IsSet() bool { + return v.isSet +} + +func (v *NullablePortAssignInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortAssignInput(val *PortAssignInput) *NullablePortAssignInput { + return &NullablePortAssignInput{value: val, isSet: true} +} + +func (v NullablePortAssignInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortAssignInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_convert_layer3_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_convert_layer3_input.go new file mode 100644 index 00000000..27ddb024 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_convert_layer3_input.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PortConvertLayer3Input type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortConvertLayer3Input{} + +// PortConvertLayer3Input struct for PortConvertLayer3Input +type PortConvertLayer3Input struct { + RequestIps []PortConvertLayer3InputRequestIpsInner `json:"request_ips,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PortConvertLayer3Input PortConvertLayer3Input + +// NewPortConvertLayer3Input instantiates a new PortConvertLayer3Input object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortConvertLayer3Input() *PortConvertLayer3Input { + this := PortConvertLayer3Input{} + return &this +} + +// NewPortConvertLayer3InputWithDefaults instantiates a new PortConvertLayer3Input object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortConvertLayer3InputWithDefaults() *PortConvertLayer3Input { + this := PortConvertLayer3Input{} + return &this +} + +// GetRequestIps returns the RequestIps field value if set, zero value otherwise. +func (o *PortConvertLayer3Input) GetRequestIps() []PortConvertLayer3InputRequestIpsInner { + if o == nil || IsNil(o.RequestIps) { + var ret []PortConvertLayer3InputRequestIpsInner + return ret + } + return o.RequestIps +} + +// GetRequestIpsOk returns a tuple with the RequestIps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortConvertLayer3Input) GetRequestIpsOk() ([]PortConvertLayer3InputRequestIpsInner, bool) { + if o == nil || IsNil(o.RequestIps) { + return nil, false + } + return o.RequestIps, true +} + +// HasRequestIps returns a boolean if a field has been set. +func (o *PortConvertLayer3Input) HasRequestIps() bool { + if o != nil && !IsNil(o.RequestIps) { + return true + } + + return false +} + +// SetRequestIps gets a reference to the given []PortConvertLayer3InputRequestIpsInner and assigns it to the RequestIps field. +func (o *PortConvertLayer3Input) SetRequestIps(v []PortConvertLayer3InputRequestIpsInner) { + o.RequestIps = v +} + +func (o PortConvertLayer3Input) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortConvertLayer3Input) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.RequestIps) { + toSerialize["request_ips"] = o.RequestIps + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortConvertLayer3Input) UnmarshalJSON(data []byte) (err error) { + varPortConvertLayer3Input := _PortConvertLayer3Input{} + + err = json.Unmarshal(data, &varPortConvertLayer3Input) + + if err != nil { + return err + } + + *o = PortConvertLayer3Input(varPortConvertLayer3Input) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "request_ips") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortConvertLayer3Input struct { + value *PortConvertLayer3Input + isSet bool +} + +func (v NullablePortConvertLayer3Input) Get() *PortConvertLayer3Input { + return v.value +} + +func (v *NullablePortConvertLayer3Input) Set(val *PortConvertLayer3Input) { + v.value = val + v.isSet = true +} + +func (v NullablePortConvertLayer3Input) IsSet() bool { + return v.isSet +} + +func (v *NullablePortConvertLayer3Input) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortConvertLayer3Input(val *PortConvertLayer3Input) *NullablePortConvertLayer3Input { + return &NullablePortConvertLayer3Input{value: val, isSet: true} +} + +func (v NullablePortConvertLayer3Input) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortConvertLayer3Input) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_convert_layer3_input_request_ips_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_convert_layer3_input_request_ips_inner.go new file mode 100644 index 00000000..53b83035 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_convert_layer3_input_request_ips_inner.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PortConvertLayer3InputRequestIpsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortConvertLayer3InputRequestIpsInner{} + +// PortConvertLayer3InputRequestIpsInner struct for PortConvertLayer3InputRequestIpsInner +type PortConvertLayer3InputRequestIpsInner struct { + AddressFamily *int32 `json:"address_family,omitempty"` + Public *bool `json:"public,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PortConvertLayer3InputRequestIpsInner PortConvertLayer3InputRequestIpsInner + +// NewPortConvertLayer3InputRequestIpsInner instantiates a new PortConvertLayer3InputRequestIpsInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortConvertLayer3InputRequestIpsInner() *PortConvertLayer3InputRequestIpsInner { + this := PortConvertLayer3InputRequestIpsInner{} + return &this +} + +// NewPortConvertLayer3InputRequestIpsInnerWithDefaults instantiates a new PortConvertLayer3InputRequestIpsInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortConvertLayer3InputRequestIpsInnerWithDefaults() *PortConvertLayer3InputRequestIpsInner { + this := PortConvertLayer3InputRequestIpsInner{} + return &this +} + +// GetAddressFamily returns the AddressFamily field value if set, zero value otherwise. +func (o *PortConvertLayer3InputRequestIpsInner) GetAddressFamily() int32 { + if o == nil || IsNil(o.AddressFamily) { + var ret int32 + return ret + } + return *o.AddressFamily +} + +// GetAddressFamilyOk returns a tuple with the AddressFamily field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortConvertLayer3InputRequestIpsInner) GetAddressFamilyOk() (*int32, bool) { + if o == nil || IsNil(o.AddressFamily) { + return nil, false + } + return o.AddressFamily, true +} + +// HasAddressFamily returns a boolean if a field has been set. +func (o *PortConvertLayer3InputRequestIpsInner) HasAddressFamily() bool { + if o != nil && !IsNil(o.AddressFamily) { + return true + } + + return false +} + +// SetAddressFamily gets a reference to the given int32 and assigns it to the AddressFamily field. +func (o *PortConvertLayer3InputRequestIpsInner) SetAddressFamily(v int32) { + o.AddressFamily = &v +} + +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *PortConvertLayer3InputRequestIpsInner) GetPublic() bool { + if o == nil || IsNil(o.Public) { + var ret bool + return ret + } + return *o.Public +} + +// GetPublicOk returns a tuple with the Public field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortConvertLayer3InputRequestIpsInner) GetPublicOk() (*bool, bool) { + if o == nil || IsNil(o.Public) { + return nil, false + } + return o.Public, true +} + +// HasPublic returns a boolean if a field has been set. +func (o *PortConvertLayer3InputRequestIpsInner) HasPublic() bool { + if o != nil && !IsNil(o.Public) { + return true + } + + return false +} + +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *PortConvertLayer3InputRequestIpsInner) SetPublic(v bool) { + o.Public = &v +} + +func (o PortConvertLayer3InputRequestIpsInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortConvertLayer3InputRequestIpsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AddressFamily) { + toSerialize["address_family"] = o.AddressFamily + } + if !IsNil(o.Public) { + toSerialize["public"] = o.Public + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortConvertLayer3InputRequestIpsInner) UnmarshalJSON(data []byte) (err error) { + varPortConvertLayer3InputRequestIpsInner := _PortConvertLayer3InputRequestIpsInner{} + + err = json.Unmarshal(data, &varPortConvertLayer3InputRequestIpsInner) + + if err != nil { + return err + } + + *o = PortConvertLayer3InputRequestIpsInner(varPortConvertLayer3InputRequestIpsInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address_family") + delete(additionalProperties, "public") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortConvertLayer3InputRequestIpsInner struct { + value *PortConvertLayer3InputRequestIpsInner + isSet bool +} + +func (v NullablePortConvertLayer3InputRequestIpsInner) Get() *PortConvertLayer3InputRequestIpsInner { + return v.value +} + +func (v *NullablePortConvertLayer3InputRequestIpsInner) Set(val *PortConvertLayer3InputRequestIpsInner) { + v.value = val + v.isSet = true +} + +func (v NullablePortConvertLayer3InputRequestIpsInner) IsSet() bool { + return v.isSet +} + +func (v *NullablePortConvertLayer3InputRequestIpsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortConvertLayer3InputRequestIpsInner(val *PortConvertLayer3InputRequestIpsInner) *NullablePortConvertLayer3InputRequestIpsInner { + return &NullablePortConvertLayer3InputRequestIpsInner{value: val, isSet: true} +} + +func (v NullablePortConvertLayer3InputRequestIpsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortConvertLayer3InputRequestIpsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_data.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_data.go new file mode 100644 index 00000000..78b5bbfe --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_data.go @@ -0,0 +1,193 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PortData type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortData{} + +// PortData struct for PortData +type PortData struct { + // MAC address is set for NetworkPort ports + Mac *string `json:"mac,omitempty"` + // Bonded is true for NetworkPort ports in a bond and NetworkBondPort ports that are active + Bonded *bool `json:"bonded,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PortData PortData + +// NewPortData instantiates a new PortData object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortData() *PortData { + this := PortData{} + return &this +} + +// NewPortDataWithDefaults instantiates a new PortData object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortDataWithDefaults() *PortData { + this := PortData{} + return &this +} + +// GetMac returns the Mac field value if set, zero value otherwise. +func (o *PortData) GetMac() string { + if o == nil || IsNil(o.Mac) { + var ret string + return ret + } + return *o.Mac +} + +// GetMacOk returns a tuple with the Mac field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortData) GetMacOk() (*string, bool) { + if o == nil || IsNil(o.Mac) { + return nil, false + } + return o.Mac, true +} + +// HasMac returns a boolean if a field has been set. +func (o *PortData) HasMac() bool { + if o != nil && !IsNil(o.Mac) { + return true + } + + return false +} + +// SetMac gets a reference to the given string and assigns it to the Mac field. +func (o *PortData) SetMac(v string) { + o.Mac = &v +} + +// GetBonded returns the Bonded field value if set, zero value otherwise. +func (o *PortData) GetBonded() bool { + if o == nil || IsNil(o.Bonded) { + var ret bool + return ret + } + return *o.Bonded +} + +// GetBondedOk returns a tuple with the Bonded field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortData) GetBondedOk() (*bool, bool) { + if o == nil || IsNil(o.Bonded) { + return nil, false + } + return o.Bonded, true +} + +// HasBonded returns a boolean if a field has been set. +func (o *PortData) HasBonded() bool { + if o != nil && !IsNil(o.Bonded) { + return true + } + + return false +} + +// SetBonded gets a reference to the given bool and assigns it to the Bonded field. +func (o *PortData) SetBonded(v bool) { + o.Bonded = &v +} + +func (o PortData) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortData) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Mac) { + toSerialize["mac"] = o.Mac + } + if !IsNil(o.Bonded) { + toSerialize["bonded"] = o.Bonded + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortData) UnmarshalJSON(data []byte) (err error) { + varPortData := _PortData{} + + err = json.Unmarshal(data, &varPortData) + + if err != nil { + return err + } + + *o = PortData(varPortData) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "mac") + delete(additionalProperties, "bonded") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortData struct { + value *PortData + isSet bool +} + +func (v NullablePortData) Get() *PortData { + return v.value +} + +func (v *NullablePortData) Set(val *PortData) { + v.value = val + v.isSet = true +} + +func (v NullablePortData) IsSet() bool { + return v.isSet +} + +func (v *NullablePortData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortData(val *PortData) *NullablePortData { + return &NullablePortData{value: val, isSet: true} +} + +func (v NullablePortData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_network_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_network_type.go new file mode 100644 index 00000000..d25fc772 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_network_type.go @@ -0,0 +1,117 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// PortNetworkType Composite network type of the bond +type PortNetworkType string + +// List of Port_network_type +const ( + PORTNETWORKTYPE_LAYER2_BONDED PortNetworkType = "layer2-bonded" + PORTNETWORKTYPE_LAYER2_INDIVIDUAL PortNetworkType = "layer2-individual" + PORTNETWORKTYPE_LAYER3 PortNetworkType = "layer3" + PORTNETWORKTYPE_HYBRID PortNetworkType = "hybrid" + PORTNETWORKTYPE_HYBRID_BONDED PortNetworkType = "hybrid-bonded" +) + +// All allowed values of PortNetworkType enum +var AllowedPortNetworkTypeEnumValues = []PortNetworkType{ + "layer2-bonded", + "layer2-individual", + "layer3", + "hybrid", + "hybrid-bonded", +} + +func (v *PortNetworkType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := PortNetworkType(value) + for _, existing := range AllowedPortNetworkTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PortNetworkType", value) +} + +// NewPortNetworkTypeFromValue returns a pointer to a valid PortNetworkType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPortNetworkTypeFromValue(v string) (*PortNetworkType, error) { + ev := PortNetworkType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PortNetworkType: valid values are %v", v, AllowedPortNetworkTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PortNetworkType) IsValid() bool { + for _, existing := range AllowedPortNetworkTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Port_network_type value +func (v PortNetworkType) Ptr() *PortNetworkType { + return &v +} + +type NullablePortNetworkType struct { + value *PortNetworkType + isSet bool +} + +func (v NullablePortNetworkType) Get() *PortNetworkType { + return v.value +} + +func (v *NullablePortNetworkType) Set(val *PortNetworkType) { + v.value = val + v.isSet = true +} + +func (v NullablePortNetworkType) IsSet() bool { + return v.isSet +} + +func (v *NullablePortNetworkType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortNetworkType(val *PortNetworkType) *NullablePortNetworkType { + return &NullablePortNetworkType{value: val, isSet: true} +} + +func (v NullablePortNetworkType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortNetworkType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_type.go new file mode 100644 index 00000000..a383a46a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_type.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// PortType Type is either \"NetworkBondPort\" for bond ports or \"NetworkPort\" for bondable ethernet ports +type PortType string + +// List of Port_type +const ( + PORTTYPE_NETWORK_PORT PortType = "NetworkPort" + PORTTYPE_NETWORK_BOND_PORT PortType = "NetworkBondPort" +) + +// All allowed values of PortType enum +var AllowedPortTypeEnumValues = []PortType{ + "NetworkPort", + "NetworkBondPort", +} + +func (v *PortType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := PortType(value) + for _, existing := range AllowedPortTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PortType", value) +} + +// NewPortTypeFromValue returns a pointer to a valid PortType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPortTypeFromValue(v string) (*PortType, error) { + ev := PortType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PortType: valid values are %v", v, AllowedPortTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PortType) IsValid() bool { + for _, existing := range AllowedPortTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Port_type value +func (v PortType) Ptr() *PortType { + return &v +} + +type NullablePortType struct { + value *PortType + isSet bool +} + +func (v NullablePortType) Get() *PortType { + return v.value +} + +func (v *NullablePortType) Set(val *PortType) { + v.value = val + v.isSet = true +} + +func (v NullablePortType) IsSet() bool { + return v.isSet +} + +func (v *NullablePortType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortType(val *PortType) *NullablePortType { + return &NullablePortType{value: val, isSet: true} +} + +func (v NullablePortType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment.go new file mode 100644 index 00000000..05971862 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment.go @@ -0,0 +1,414 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the PortVlanAssignment type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortVlanAssignment{} + +// PortVlanAssignment struct for PortVlanAssignment +type PortVlanAssignment struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + Id *string `json:"id,omitempty"` + Native *bool `json:"native,omitempty"` + Port *Href `json:"port,omitempty"` + State *PortVlanAssignmentState `json:"state,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + VirtualNetwork *Href `json:"virtual_network,omitempty"` + Vlan *int32 `json:"vlan,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PortVlanAssignment PortVlanAssignment + +// NewPortVlanAssignment instantiates a new PortVlanAssignment object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortVlanAssignment() *PortVlanAssignment { + this := PortVlanAssignment{} + return &this +} + +// NewPortVlanAssignmentWithDefaults instantiates a new PortVlanAssignment object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortVlanAssignmentWithDefaults() *PortVlanAssignment { + this := PortVlanAssignment{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *PortVlanAssignment) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignment) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *PortVlanAssignment) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *PortVlanAssignment) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PortVlanAssignment) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignment) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *PortVlanAssignment) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PortVlanAssignment) SetId(v string) { + o.Id = &v +} + +// GetNative returns the Native field value if set, zero value otherwise. +func (o *PortVlanAssignment) GetNative() bool { + if o == nil || IsNil(o.Native) { + var ret bool + return ret + } + return *o.Native +} + +// GetNativeOk returns a tuple with the Native field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignment) GetNativeOk() (*bool, bool) { + if o == nil || IsNil(o.Native) { + return nil, false + } + return o.Native, true +} + +// HasNative returns a boolean if a field has been set. +func (o *PortVlanAssignment) HasNative() bool { + if o != nil && !IsNil(o.Native) { + return true + } + + return false +} + +// SetNative gets a reference to the given bool and assigns it to the Native field. +func (o *PortVlanAssignment) SetNative(v bool) { + o.Native = &v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *PortVlanAssignment) GetPort() Href { + if o == nil || IsNil(o.Port) { + var ret Href + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignment) GetPortOk() (*Href, bool) { + if o == nil || IsNil(o.Port) { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *PortVlanAssignment) HasPort() bool { + if o != nil && !IsNil(o.Port) { + return true + } + + return false +} + +// SetPort gets a reference to the given Href and assigns it to the Port field. +func (o *PortVlanAssignment) SetPort(v Href) { + o.Port = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *PortVlanAssignment) GetState() PortVlanAssignmentState { + if o == nil || IsNil(o.State) { + var ret PortVlanAssignmentState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignment) GetStateOk() (*PortVlanAssignmentState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *PortVlanAssignment) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given PortVlanAssignmentState and assigns it to the State field. +func (o *PortVlanAssignment) SetState(v PortVlanAssignmentState) { + o.State = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *PortVlanAssignment) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignment) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *PortVlanAssignment) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *PortVlanAssignment) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetVirtualNetwork returns the VirtualNetwork field value if set, zero value otherwise. +func (o *PortVlanAssignment) GetVirtualNetwork() Href { + if o == nil || IsNil(o.VirtualNetwork) { + var ret Href + return ret + } + return *o.VirtualNetwork +} + +// GetVirtualNetworkOk returns a tuple with the VirtualNetwork field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignment) GetVirtualNetworkOk() (*Href, bool) { + if o == nil || IsNil(o.VirtualNetwork) { + return nil, false + } + return o.VirtualNetwork, true +} + +// HasVirtualNetwork returns a boolean if a field has been set. +func (o *PortVlanAssignment) HasVirtualNetwork() bool { + if o != nil && !IsNil(o.VirtualNetwork) { + return true + } + + return false +} + +// SetVirtualNetwork gets a reference to the given Href and assigns it to the VirtualNetwork field. +func (o *PortVlanAssignment) SetVirtualNetwork(v Href) { + o.VirtualNetwork = &v +} + +// GetVlan returns the Vlan field value if set, zero value otherwise. +func (o *PortVlanAssignment) GetVlan() int32 { + if o == nil || IsNil(o.Vlan) { + var ret int32 + return ret + } + return *o.Vlan +} + +// GetVlanOk returns a tuple with the Vlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignment) GetVlanOk() (*int32, bool) { + if o == nil || IsNil(o.Vlan) { + return nil, false + } + return o.Vlan, true +} + +// HasVlan returns a boolean if a field has been set. +func (o *PortVlanAssignment) HasVlan() bool { + if o != nil && !IsNil(o.Vlan) { + return true + } + + return false +} + +// SetVlan gets a reference to the given int32 and assigns it to the Vlan field. +func (o *PortVlanAssignment) SetVlan(v int32) { + o.Vlan = &v +} + +func (o PortVlanAssignment) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortVlanAssignment) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Native) { + toSerialize["native"] = o.Native + } + if !IsNil(o.Port) { + toSerialize["port"] = o.Port + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.VirtualNetwork) { + toSerialize["virtual_network"] = o.VirtualNetwork + } + if !IsNil(o.Vlan) { + toSerialize["vlan"] = o.Vlan + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortVlanAssignment) UnmarshalJSON(data []byte) (err error) { + varPortVlanAssignment := _PortVlanAssignment{} + + err = json.Unmarshal(data, &varPortVlanAssignment) + + if err != nil { + return err + } + + *o = PortVlanAssignment(varPortVlanAssignment) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "id") + delete(additionalProperties, "native") + delete(additionalProperties, "port") + delete(additionalProperties, "state") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "virtual_network") + delete(additionalProperties, "vlan") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortVlanAssignment struct { + value *PortVlanAssignment + isSet bool +} + +func (v NullablePortVlanAssignment) Get() *PortVlanAssignment { + return v.value +} + +func (v *NullablePortVlanAssignment) Set(val *PortVlanAssignment) { + v.value = val + v.isSet = true +} + +func (v NullablePortVlanAssignment) IsSet() bool { + return v.isSet +} + +func (v *NullablePortVlanAssignment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortVlanAssignment(val *PortVlanAssignment) *NullablePortVlanAssignment { + return &NullablePortVlanAssignment{value: val, isSet: true} +} + +func (v NullablePortVlanAssignment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortVlanAssignment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch.go new file mode 100644 index 00000000..69886b4a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch.go @@ -0,0 +1,451 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the PortVlanAssignmentBatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortVlanAssignmentBatch{} + +// PortVlanAssignmentBatch struct for PortVlanAssignmentBatch +type PortVlanAssignmentBatch struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + ErrorMessages []string `json:"error_messages,omitempty"` + Id *string `json:"id,omitempty"` + Port *Port `json:"port,omitempty"` + Quantity *int32 `json:"quantity,omitempty"` + State *PortVlanAssignmentBatchState `json:"state,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + VlanAssignments []PortVlanAssignmentBatchVlanAssignmentsInner `json:"vlan_assignments,omitempty"` + Project *Href `json:"project,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PortVlanAssignmentBatch PortVlanAssignmentBatch + +// NewPortVlanAssignmentBatch instantiates a new PortVlanAssignmentBatch object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortVlanAssignmentBatch() *PortVlanAssignmentBatch { + this := PortVlanAssignmentBatch{} + return &this +} + +// NewPortVlanAssignmentBatchWithDefaults instantiates a new PortVlanAssignmentBatch object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortVlanAssignmentBatchWithDefaults() *PortVlanAssignmentBatch { + this := PortVlanAssignmentBatch{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatch) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatch) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatch) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *PortVlanAssignmentBatch) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetErrorMessages returns the ErrorMessages field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatch) GetErrorMessages() []string { + if o == nil || IsNil(o.ErrorMessages) { + var ret []string + return ret + } + return o.ErrorMessages +} + +// GetErrorMessagesOk returns a tuple with the ErrorMessages field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatch) GetErrorMessagesOk() ([]string, bool) { + if o == nil || IsNil(o.ErrorMessages) { + return nil, false + } + return o.ErrorMessages, true +} + +// HasErrorMessages returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatch) HasErrorMessages() bool { + if o != nil && !IsNil(o.ErrorMessages) { + return true + } + + return false +} + +// SetErrorMessages gets a reference to the given []string and assigns it to the ErrorMessages field. +func (o *PortVlanAssignmentBatch) SetErrorMessages(v []string) { + o.ErrorMessages = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatch) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatch) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatch) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PortVlanAssignmentBatch) SetId(v string) { + o.Id = &v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatch) GetPort() Port { + if o == nil || IsNil(o.Port) { + var ret Port + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatch) GetPortOk() (*Port, bool) { + if o == nil || IsNil(o.Port) { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatch) HasPort() bool { + if o != nil && !IsNil(o.Port) { + return true + } + + return false +} + +// SetPort gets a reference to the given Port and assigns it to the Port field. +func (o *PortVlanAssignmentBatch) SetPort(v Port) { + o.Port = &v +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatch) GetQuantity() int32 { + if o == nil || IsNil(o.Quantity) { + var ret int32 + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatch) GetQuantityOk() (*int32, bool) { + if o == nil || IsNil(o.Quantity) { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatch) HasQuantity() bool { + if o != nil && !IsNil(o.Quantity) { + return true + } + + return false +} + +// SetQuantity gets a reference to the given int32 and assigns it to the Quantity field. +func (o *PortVlanAssignmentBatch) SetQuantity(v int32) { + o.Quantity = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatch) GetState() PortVlanAssignmentBatchState { + if o == nil || IsNil(o.State) { + var ret PortVlanAssignmentBatchState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatch) GetStateOk() (*PortVlanAssignmentBatchState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatch) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given PortVlanAssignmentBatchState and assigns it to the State field. +func (o *PortVlanAssignmentBatch) SetState(v PortVlanAssignmentBatchState) { + o.State = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatch) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatch) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatch) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *PortVlanAssignmentBatch) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetVlanAssignments returns the VlanAssignments field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatch) GetVlanAssignments() []PortVlanAssignmentBatchVlanAssignmentsInner { + if o == nil || IsNil(o.VlanAssignments) { + var ret []PortVlanAssignmentBatchVlanAssignmentsInner + return ret + } + return o.VlanAssignments +} + +// GetVlanAssignmentsOk returns a tuple with the VlanAssignments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatch) GetVlanAssignmentsOk() ([]PortVlanAssignmentBatchVlanAssignmentsInner, bool) { + if o == nil || IsNil(o.VlanAssignments) { + return nil, false + } + return o.VlanAssignments, true +} + +// HasVlanAssignments returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatch) HasVlanAssignments() bool { + if o != nil && !IsNil(o.VlanAssignments) { + return true + } + + return false +} + +// SetVlanAssignments gets a reference to the given []PortVlanAssignmentBatchVlanAssignmentsInner and assigns it to the VlanAssignments field. +func (o *PortVlanAssignmentBatch) SetVlanAssignments(v []PortVlanAssignmentBatchVlanAssignmentsInner) { + o.VlanAssignments = v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatch) GetProject() Href { + if o == nil || IsNil(o.Project) { + var ret Href + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatch) GetProjectOk() (*Href, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatch) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Href and assigns it to the Project field. +func (o *PortVlanAssignmentBatch) SetProject(v Href) { + o.Project = &v +} + +func (o PortVlanAssignmentBatch) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortVlanAssignmentBatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.ErrorMessages) { + toSerialize["error_messages"] = o.ErrorMessages + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Port) { + toSerialize["port"] = o.Port + } + if !IsNil(o.Quantity) { + toSerialize["quantity"] = o.Quantity + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.VlanAssignments) { + toSerialize["vlan_assignments"] = o.VlanAssignments + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortVlanAssignmentBatch) UnmarshalJSON(data []byte) (err error) { + varPortVlanAssignmentBatch := _PortVlanAssignmentBatch{} + + err = json.Unmarshal(data, &varPortVlanAssignmentBatch) + + if err != nil { + return err + } + + *o = PortVlanAssignmentBatch(varPortVlanAssignmentBatch) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "error_messages") + delete(additionalProperties, "id") + delete(additionalProperties, "port") + delete(additionalProperties, "quantity") + delete(additionalProperties, "state") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "vlan_assignments") + delete(additionalProperties, "project") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortVlanAssignmentBatch struct { + value *PortVlanAssignmentBatch + isSet bool +} + +func (v NullablePortVlanAssignmentBatch) Get() *PortVlanAssignmentBatch { + return v.value +} + +func (v *NullablePortVlanAssignmentBatch) Set(val *PortVlanAssignmentBatch) { + v.value = val + v.isSet = true +} + +func (v NullablePortVlanAssignmentBatch) IsSet() bool { + return v.isSet +} + +func (v *NullablePortVlanAssignmentBatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortVlanAssignmentBatch(val *PortVlanAssignmentBatch) *NullablePortVlanAssignmentBatch { + return &NullablePortVlanAssignmentBatch{value: val, isSet: true} +} + +func (v NullablePortVlanAssignmentBatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortVlanAssignmentBatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_create_input.go new file mode 100644 index 00000000..1c1d34a2 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_create_input.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PortVlanAssignmentBatchCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortVlanAssignmentBatchCreateInput{} + +// PortVlanAssignmentBatchCreateInput struct for PortVlanAssignmentBatchCreateInput +type PortVlanAssignmentBatchCreateInput struct { + VlanAssignments []PortVlanAssignmentBatchCreateInputVlanAssignmentsInner `json:"vlan_assignments,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PortVlanAssignmentBatchCreateInput PortVlanAssignmentBatchCreateInput + +// NewPortVlanAssignmentBatchCreateInput instantiates a new PortVlanAssignmentBatchCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortVlanAssignmentBatchCreateInput() *PortVlanAssignmentBatchCreateInput { + this := PortVlanAssignmentBatchCreateInput{} + return &this +} + +// NewPortVlanAssignmentBatchCreateInputWithDefaults instantiates a new PortVlanAssignmentBatchCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortVlanAssignmentBatchCreateInputWithDefaults() *PortVlanAssignmentBatchCreateInput { + this := PortVlanAssignmentBatchCreateInput{} + return &this +} + +// GetVlanAssignments returns the VlanAssignments field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatchCreateInput) GetVlanAssignments() []PortVlanAssignmentBatchCreateInputVlanAssignmentsInner { + if o == nil || IsNil(o.VlanAssignments) { + var ret []PortVlanAssignmentBatchCreateInputVlanAssignmentsInner + return ret + } + return o.VlanAssignments +} + +// GetVlanAssignmentsOk returns a tuple with the VlanAssignments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatchCreateInput) GetVlanAssignmentsOk() ([]PortVlanAssignmentBatchCreateInputVlanAssignmentsInner, bool) { + if o == nil || IsNil(o.VlanAssignments) { + return nil, false + } + return o.VlanAssignments, true +} + +// HasVlanAssignments returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatchCreateInput) HasVlanAssignments() bool { + if o != nil && !IsNil(o.VlanAssignments) { + return true + } + + return false +} + +// SetVlanAssignments gets a reference to the given []PortVlanAssignmentBatchCreateInputVlanAssignmentsInner and assigns it to the VlanAssignments field. +func (o *PortVlanAssignmentBatchCreateInput) SetVlanAssignments(v []PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) { + o.VlanAssignments = v +} + +func (o PortVlanAssignmentBatchCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortVlanAssignmentBatchCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.VlanAssignments) { + toSerialize["vlan_assignments"] = o.VlanAssignments + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortVlanAssignmentBatchCreateInput) UnmarshalJSON(data []byte) (err error) { + varPortVlanAssignmentBatchCreateInput := _PortVlanAssignmentBatchCreateInput{} + + err = json.Unmarshal(data, &varPortVlanAssignmentBatchCreateInput) + + if err != nil { + return err + } + + *o = PortVlanAssignmentBatchCreateInput(varPortVlanAssignmentBatchCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "vlan_assignments") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortVlanAssignmentBatchCreateInput struct { + value *PortVlanAssignmentBatchCreateInput + isSet bool +} + +func (v NullablePortVlanAssignmentBatchCreateInput) Get() *PortVlanAssignmentBatchCreateInput { + return v.value +} + +func (v *NullablePortVlanAssignmentBatchCreateInput) Set(val *PortVlanAssignmentBatchCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullablePortVlanAssignmentBatchCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullablePortVlanAssignmentBatchCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortVlanAssignmentBatchCreateInput(val *PortVlanAssignmentBatchCreateInput) *NullablePortVlanAssignmentBatchCreateInput { + return &NullablePortVlanAssignmentBatchCreateInput{value: val, isSet: true} +} + +func (v NullablePortVlanAssignmentBatchCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortVlanAssignmentBatchCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_create_input_vlan_assignments_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_create_input_vlan_assignments_inner.go new file mode 100644 index 00000000..605825dc --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_create_input_vlan_assignments_inner.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PortVlanAssignmentBatchCreateInputVlanAssignmentsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortVlanAssignmentBatchCreateInputVlanAssignmentsInner{} + +// PortVlanAssignmentBatchCreateInputVlanAssignmentsInner struct for PortVlanAssignmentBatchCreateInputVlanAssignmentsInner +type PortVlanAssignmentBatchCreateInputVlanAssignmentsInner struct { + Native *bool `json:"native,omitempty"` + State *PortVlanAssignmentBatchVlanAssignmentsInnerState `json:"state,omitempty"` + Vlan *string `json:"vlan,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PortVlanAssignmentBatchCreateInputVlanAssignmentsInner PortVlanAssignmentBatchCreateInputVlanAssignmentsInner + +// NewPortVlanAssignmentBatchCreateInputVlanAssignmentsInner instantiates a new PortVlanAssignmentBatchCreateInputVlanAssignmentsInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortVlanAssignmentBatchCreateInputVlanAssignmentsInner() *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner { + this := PortVlanAssignmentBatchCreateInputVlanAssignmentsInner{} + return &this +} + +// NewPortVlanAssignmentBatchCreateInputVlanAssignmentsInnerWithDefaults instantiates a new PortVlanAssignmentBatchCreateInputVlanAssignmentsInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortVlanAssignmentBatchCreateInputVlanAssignmentsInnerWithDefaults() *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner { + this := PortVlanAssignmentBatchCreateInputVlanAssignmentsInner{} + return &this +} + +// GetNative returns the Native field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) GetNative() bool { + if o == nil || IsNil(o.Native) { + var ret bool + return ret + } + return *o.Native +} + +// GetNativeOk returns a tuple with the Native field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) GetNativeOk() (*bool, bool) { + if o == nil || IsNil(o.Native) { + return nil, false + } + return o.Native, true +} + +// HasNative returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) HasNative() bool { + if o != nil && !IsNil(o.Native) { + return true + } + + return false +} + +// SetNative gets a reference to the given bool and assigns it to the Native field. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) SetNative(v bool) { + o.Native = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) GetState() PortVlanAssignmentBatchVlanAssignmentsInnerState { + if o == nil || IsNil(o.State) { + var ret PortVlanAssignmentBatchVlanAssignmentsInnerState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) GetStateOk() (*PortVlanAssignmentBatchVlanAssignmentsInnerState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given PortVlanAssignmentBatchVlanAssignmentsInnerState and assigns it to the State field. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) SetState(v PortVlanAssignmentBatchVlanAssignmentsInnerState) { + o.State = &v +} + +// GetVlan returns the Vlan field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) GetVlan() string { + if o == nil || IsNil(o.Vlan) { + var ret string + return ret + } + return *o.Vlan +} + +// GetVlanOk returns a tuple with the Vlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) GetVlanOk() (*string, bool) { + if o == nil || IsNil(o.Vlan) { + return nil, false + } + return o.Vlan, true +} + +// HasVlan returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) HasVlan() bool { + if o != nil && !IsNil(o.Vlan) { + return true + } + + return false +} + +// SetVlan gets a reference to the given string and assigns it to the Vlan field. +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) SetVlan(v string) { + o.Vlan = &v +} + +func (o PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Native) { + toSerialize["native"] = o.Native + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Vlan) { + toSerialize["vlan"] = o.Vlan + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) UnmarshalJSON(data []byte) (err error) { + varPortVlanAssignmentBatchCreateInputVlanAssignmentsInner := _PortVlanAssignmentBatchCreateInputVlanAssignmentsInner{} + + err = json.Unmarshal(data, &varPortVlanAssignmentBatchCreateInputVlanAssignmentsInner) + + if err != nil { + return err + } + + *o = PortVlanAssignmentBatchCreateInputVlanAssignmentsInner(varPortVlanAssignmentBatchCreateInputVlanAssignmentsInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "native") + delete(additionalProperties, "state") + delete(additionalProperties, "vlan") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortVlanAssignmentBatchCreateInputVlanAssignmentsInner struct { + value *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner + isSet bool +} + +func (v NullablePortVlanAssignmentBatchCreateInputVlanAssignmentsInner) Get() *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner { + return v.value +} + +func (v *NullablePortVlanAssignmentBatchCreateInputVlanAssignmentsInner) Set(val *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) { + v.value = val + v.isSet = true +} + +func (v NullablePortVlanAssignmentBatchCreateInputVlanAssignmentsInner) IsSet() bool { + return v.isSet +} + +func (v *NullablePortVlanAssignmentBatchCreateInputVlanAssignmentsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortVlanAssignmentBatchCreateInputVlanAssignmentsInner(val *PortVlanAssignmentBatchCreateInputVlanAssignmentsInner) *NullablePortVlanAssignmentBatchCreateInputVlanAssignmentsInner { + return &NullablePortVlanAssignmentBatchCreateInputVlanAssignmentsInner{value: val, isSet: true} +} + +func (v NullablePortVlanAssignmentBatchCreateInputVlanAssignmentsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortVlanAssignmentBatchCreateInputVlanAssignmentsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_list.go new file mode 100644 index 00000000..78863678 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PortVlanAssignmentBatchList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortVlanAssignmentBatchList{} + +// PortVlanAssignmentBatchList struct for PortVlanAssignmentBatchList +type PortVlanAssignmentBatchList struct { + Batches []PortVlanAssignmentBatch `json:"batches,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PortVlanAssignmentBatchList PortVlanAssignmentBatchList + +// NewPortVlanAssignmentBatchList instantiates a new PortVlanAssignmentBatchList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortVlanAssignmentBatchList() *PortVlanAssignmentBatchList { + this := PortVlanAssignmentBatchList{} + return &this +} + +// NewPortVlanAssignmentBatchListWithDefaults instantiates a new PortVlanAssignmentBatchList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortVlanAssignmentBatchListWithDefaults() *PortVlanAssignmentBatchList { + this := PortVlanAssignmentBatchList{} + return &this +} + +// GetBatches returns the Batches field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatchList) GetBatches() []PortVlanAssignmentBatch { + if o == nil || IsNil(o.Batches) { + var ret []PortVlanAssignmentBatch + return ret + } + return o.Batches +} + +// GetBatchesOk returns a tuple with the Batches field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatchList) GetBatchesOk() ([]PortVlanAssignmentBatch, bool) { + if o == nil || IsNil(o.Batches) { + return nil, false + } + return o.Batches, true +} + +// HasBatches returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatchList) HasBatches() bool { + if o != nil && !IsNil(o.Batches) { + return true + } + + return false +} + +// SetBatches gets a reference to the given []PortVlanAssignmentBatch and assigns it to the Batches field. +func (o *PortVlanAssignmentBatchList) SetBatches(v []PortVlanAssignmentBatch) { + o.Batches = v +} + +func (o PortVlanAssignmentBatchList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortVlanAssignmentBatchList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Batches) { + toSerialize["batches"] = o.Batches + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortVlanAssignmentBatchList) UnmarshalJSON(data []byte) (err error) { + varPortVlanAssignmentBatchList := _PortVlanAssignmentBatchList{} + + err = json.Unmarshal(data, &varPortVlanAssignmentBatchList) + + if err != nil { + return err + } + + *o = PortVlanAssignmentBatchList(varPortVlanAssignmentBatchList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "batches") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortVlanAssignmentBatchList struct { + value *PortVlanAssignmentBatchList + isSet bool +} + +func (v NullablePortVlanAssignmentBatchList) Get() *PortVlanAssignmentBatchList { + return v.value +} + +func (v *NullablePortVlanAssignmentBatchList) Set(val *PortVlanAssignmentBatchList) { + v.value = val + v.isSet = true +} + +func (v NullablePortVlanAssignmentBatchList) IsSet() bool { + return v.isSet +} + +func (v *NullablePortVlanAssignmentBatchList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortVlanAssignmentBatchList(val *PortVlanAssignmentBatchList) *NullablePortVlanAssignmentBatchList { + return &NullablePortVlanAssignmentBatchList{value: val, isSet: true} +} + +func (v NullablePortVlanAssignmentBatchList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortVlanAssignmentBatchList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_state.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_state.go new file mode 100644 index 00000000..4f82ec14 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_state.go @@ -0,0 +1,115 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// PortVlanAssignmentBatchState the model 'PortVlanAssignmentBatchState' +type PortVlanAssignmentBatchState string + +// List of PortVlanAssignmentBatch_state +const ( + PORTVLANASSIGNMENTBATCHSTATE_QUEUED PortVlanAssignmentBatchState = "queued" + PORTVLANASSIGNMENTBATCHSTATE_IN_PROGRESS PortVlanAssignmentBatchState = "in_progress" + PORTVLANASSIGNMENTBATCHSTATE_COMPLETED PortVlanAssignmentBatchState = "completed" + PORTVLANASSIGNMENTBATCHSTATE_FAILED PortVlanAssignmentBatchState = "failed" +) + +// All allowed values of PortVlanAssignmentBatchState enum +var AllowedPortVlanAssignmentBatchStateEnumValues = []PortVlanAssignmentBatchState{ + "queued", + "in_progress", + "completed", + "failed", +} + +func (v *PortVlanAssignmentBatchState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := PortVlanAssignmentBatchState(value) + for _, existing := range AllowedPortVlanAssignmentBatchStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PortVlanAssignmentBatchState", value) +} + +// NewPortVlanAssignmentBatchStateFromValue returns a pointer to a valid PortVlanAssignmentBatchState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPortVlanAssignmentBatchStateFromValue(v string) (*PortVlanAssignmentBatchState, error) { + ev := PortVlanAssignmentBatchState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PortVlanAssignmentBatchState: valid values are %v", v, AllowedPortVlanAssignmentBatchStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PortVlanAssignmentBatchState) IsValid() bool { + for _, existing := range AllowedPortVlanAssignmentBatchStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to PortVlanAssignmentBatch_state value +func (v PortVlanAssignmentBatchState) Ptr() *PortVlanAssignmentBatchState { + return &v +} + +type NullablePortVlanAssignmentBatchState struct { + value *PortVlanAssignmentBatchState + isSet bool +} + +func (v NullablePortVlanAssignmentBatchState) Get() *PortVlanAssignmentBatchState { + return v.value +} + +func (v *NullablePortVlanAssignmentBatchState) Set(val *PortVlanAssignmentBatchState) { + v.value = val + v.isSet = true +} + +func (v NullablePortVlanAssignmentBatchState) IsSet() bool { + return v.isSet +} + +func (v *NullablePortVlanAssignmentBatchState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortVlanAssignmentBatchState(val *PortVlanAssignmentBatchState) *NullablePortVlanAssignmentBatchState { + return &NullablePortVlanAssignmentBatchState{value: val, isSet: true} +} + +func (v NullablePortVlanAssignmentBatchState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortVlanAssignmentBatchState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_vlan_assignments_inner.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_vlan_assignments_inner.go new file mode 100644 index 00000000..045480ec --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_vlan_assignments_inner.go @@ -0,0 +1,265 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PortVlanAssignmentBatchVlanAssignmentsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortVlanAssignmentBatchVlanAssignmentsInner{} + +// PortVlanAssignmentBatchVlanAssignmentsInner struct for PortVlanAssignmentBatchVlanAssignmentsInner +type PortVlanAssignmentBatchVlanAssignmentsInner struct { + Id *string `json:"id,omitempty"` + Native *bool `json:"native,omitempty"` + State *PortVlanAssignmentBatchVlanAssignmentsInnerState `json:"state,omitempty"` + Vlan *int32 `json:"vlan,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PortVlanAssignmentBatchVlanAssignmentsInner PortVlanAssignmentBatchVlanAssignmentsInner + +// NewPortVlanAssignmentBatchVlanAssignmentsInner instantiates a new PortVlanAssignmentBatchVlanAssignmentsInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortVlanAssignmentBatchVlanAssignmentsInner() *PortVlanAssignmentBatchVlanAssignmentsInner { + this := PortVlanAssignmentBatchVlanAssignmentsInner{} + return &this +} + +// NewPortVlanAssignmentBatchVlanAssignmentsInnerWithDefaults instantiates a new PortVlanAssignmentBatchVlanAssignmentsInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortVlanAssignmentBatchVlanAssignmentsInnerWithDefaults() *PortVlanAssignmentBatchVlanAssignmentsInner { + this := PortVlanAssignmentBatchVlanAssignmentsInner{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) SetId(v string) { + o.Id = &v +} + +// GetNative returns the Native field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) GetNative() bool { + if o == nil || IsNil(o.Native) { + var ret bool + return ret + } + return *o.Native +} + +// GetNativeOk returns a tuple with the Native field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) GetNativeOk() (*bool, bool) { + if o == nil || IsNil(o.Native) { + return nil, false + } + return o.Native, true +} + +// HasNative returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) HasNative() bool { + if o != nil && !IsNil(o.Native) { + return true + } + + return false +} + +// SetNative gets a reference to the given bool and assigns it to the Native field. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) SetNative(v bool) { + o.Native = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) GetState() PortVlanAssignmentBatchVlanAssignmentsInnerState { + if o == nil || IsNil(o.State) { + var ret PortVlanAssignmentBatchVlanAssignmentsInnerState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) GetStateOk() (*PortVlanAssignmentBatchVlanAssignmentsInnerState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given PortVlanAssignmentBatchVlanAssignmentsInnerState and assigns it to the State field. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) SetState(v PortVlanAssignmentBatchVlanAssignmentsInnerState) { + o.State = &v +} + +// GetVlan returns the Vlan field value if set, zero value otherwise. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) GetVlan() int32 { + if o == nil || IsNil(o.Vlan) { + var ret int32 + return ret + } + return *o.Vlan +} + +// GetVlanOk returns a tuple with the Vlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) GetVlanOk() (*int32, bool) { + if o == nil || IsNil(o.Vlan) { + return nil, false + } + return o.Vlan, true +} + +// HasVlan returns a boolean if a field has been set. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) HasVlan() bool { + if o != nil && !IsNil(o.Vlan) { + return true + } + + return false +} + +// SetVlan gets a reference to the given int32 and assigns it to the Vlan field. +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) SetVlan(v int32) { + o.Vlan = &v +} + +func (o PortVlanAssignmentBatchVlanAssignmentsInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortVlanAssignmentBatchVlanAssignmentsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Native) { + toSerialize["native"] = o.Native + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Vlan) { + toSerialize["vlan"] = o.Vlan + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortVlanAssignmentBatchVlanAssignmentsInner) UnmarshalJSON(data []byte) (err error) { + varPortVlanAssignmentBatchVlanAssignmentsInner := _PortVlanAssignmentBatchVlanAssignmentsInner{} + + err = json.Unmarshal(data, &varPortVlanAssignmentBatchVlanAssignmentsInner) + + if err != nil { + return err + } + + *o = PortVlanAssignmentBatchVlanAssignmentsInner(varPortVlanAssignmentBatchVlanAssignmentsInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "native") + delete(additionalProperties, "state") + delete(additionalProperties, "vlan") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortVlanAssignmentBatchVlanAssignmentsInner struct { + value *PortVlanAssignmentBatchVlanAssignmentsInner + isSet bool +} + +func (v NullablePortVlanAssignmentBatchVlanAssignmentsInner) Get() *PortVlanAssignmentBatchVlanAssignmentsInner { + return v.value +} + +func (v *NullablePortVlanAssignmentBatchVlanAssignmentsInner) Set(val *PortVlanAssignmentBatchVlanAssignmentsInner) { + v.value = val + v.isSet = true +} + +func (v NullablePortVlanAssignmentBatchVlanAssignmentsInner) IsSet() bool { + return v.isSet +} + +func (v *NullablePortVlanAssignmentBatchVlanAssignmentsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortVlanAssignmentBatchVlanAssignmentsInner(val *PortVlanAssignmentBatchVlanAssignmentsInner) *NullablePortVlanAssignmentBatchVlanAssignmentsInner { + return &NullablePortVlanAssignmentBatchVlanAssignmentsInner{value: val, isSet: true} +} + +func (v NullablePortVlanAssignmentBatchVlanAssignmentsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortVlanAssignmentBatchVlanAssignmentsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_vlan_assignments_inner_state.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_vlan_assignments_inner_state.go new file mode 100644 index 00000000..dcb56557 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_batch_vlan_assignments_inner_state.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// PortVlanAssignmentBatchVlanAssignmentsInnerState the model 'PortVlanAssignmentBatchVlanAssignmentsInnerState' +type PortVlanAssignmentBatchVlanAssignmentsInnerState string + +// List of PortVlanAssignmentBatch_vlan_assignments_inner_state +const ( + PORTVLANASSIGNMENTBATCHVLANASSIGNMENTSINNERSTATE_ASSIGNED PortVlanAssignmentBatchVlanAssignmentsInnerState = "assigned" + PORTVLANASSIGNMENTBATCHVLANASSIGNMENTSINNERSTATE_UNASSIGNED PortVlanAssignmentBatchVlanAssignmentsInnerState = "unassigned" +) + +// All allowed values of PortVlanAssignmentBatchVlanAssignmentsInnerState enum +var AllowedPortVlanAssignmentBatchVlanAssignmentsInnerStateEnumValues = []PortVlanAssignmentBatchVlanAssignmentsInnerState{ + "assigned", + "unassigned", +} + +func (v *PortVlanAssignmentBatchVlanAssignmentsInnerState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := PortVlanAssignmentBatchVlanAssignmentsInnerState(value) + for _, existing := range AllowedPortVlanAssignmentBatchVlanAssignmentsInnerStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PortVlanAssignmentBatchVlanAssignmentsInnerState", value) +} + +// NewPortVlanAssignmentBatchVlanAssignmentsInnerStateFromValue returns a pointer to a valid PortVlanAssignmentBatchVlanAssignmentsInnerState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPortVlanAssignmentBatchVlanAssignmentsInnerStateFromValue(v string) (*PortVlanAssignmentBatchVlanAssignmentsInnerState, error) { + ev := PortVlanAssignmentBatchVlanAssignmentsInnerState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PortVlanAssignmentBatchVlanAssignmentsInnerState: valid values are %v", v, AllowedPortVlanAssignmentBatchVlanAssignmentsInnerStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PortVlanAssignmentBatchVlanAssignmentsInnerState) IsValid() bool { + for _, existing := range AllowedPortVlanAssignmentBatchVlanAssignmentsInnerStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to PortVlanAssignmentBatch_vlan_assignments_inner_state value +func (v PortVlanAssignmentBatchVlanAssignmentsInnerState) Ptr() *PortVlanAssignmentBatchVlanAssignmentsInnerState { + return &v +} + +type NullablePortVlanAssignmentBatchVlanAssignmentsInnerState struct { + value *PortVlanAssignmentBatchVlanAssignmentsInnerState + isSet bool +} + +func (v NullablePortVlanAssignmentBatchVlanAssignmentsInnerState) Get() *PortVlanAssignmentBatchVlanAssignmentsInnerState { + return v.value +} + +func (v *NullablePortVlanAssignmentBatchVlanAssignmentsInnerState) Set(val *PortVlanAssignmentBatchVlanAssignmentsInnerState) { + v.value = val + v.isSet = true +} + +func (v NullablePortVlanAssignmentBatchVlanAssignmentsInnerState) IsSet() bool { + return v.isSet +} + +func (v *NullablePortVlanAssignmentBatchVlanAssignmentsInnerState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortVlanAssignmentBatchVlanAssignmentsInnerState(val *PortVlanAssignmentBatchVlanAssignmentsInnerState) *NullablePortVlanAssignmentBatchVlanAssignmentsInnerState { + return &NullablePortVlanAssignmentBatchVlanAssignmentsInnerState{value: val, isSet: true} +} + +func (v NullablePortVlanAssignmentBatchVlanAssignmentsInnerState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortVlanAssignmentBatchVlanAssignmentsInnerState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_list.go new file mode 100644 index 00000000..553f891a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the PortVlanAssignmentList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortVlanAssignmentList{} + +// PortVlanAssignmentList struct for PortVlanAssignmentList +type PortVlanAssignmentList struct { + VlanAssignments []PortVlanAssignment `json:"vlan_assignments,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PortVlanAssignmentList PortVlanAssignmentList + +// NewPortVlanAssignmentList instantiates a new PortVlanAssignmentList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortVlanAssignmentList() *PortVlanAssignmentList { + this := PortVlanAssignmentList{} + return &this +} + +// NewPortVlanAssignmentListWithDefaults instantiates a new PortVlanAssignmentList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortVlanAssignmentListWithDefaults() *PortVlanAssignmentList { + this := PortVlanAssignmentList{} + return &this +} + +// GetVlanAssignments returns the VlanAssignments field value if set, zero value otherwise. +func (o *PortVlanAssignmentList) GetVlanAssignments() []PortVlanAssignment { + if o == nil || IsNil(o.VlanAssignments) { + var ret []PortVlanAssignment + return ret + } + return o.VlanAssignments +} + +// GetVlanAssignmentsOk returns a tuple with the VlanAssignments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PortVlanAssignmentList) GetVlanAssignmentsOk() ([]PortVlanAssignment, bool) { + if o == nil || IsNil(o.VlanAssignments) { + return nil, false + } + return o.VlanAssignments, true +} + +// HasVlanAssignments returns a boolean if a field has been set. +func (o *PortVlanAssignmentList) HasVlanAssignments() bool { + if o != nil && !IsNil(o.VlanAssignments) { + return true + } + + return false +} + +// SetVlanAssignments gets a reference to the given []PortVlanAssignment and assigns it to the VlanAssignments field. +func (o *PortVlanAssignmentList) SetVlanAssignments(v []PortVlanAssignment) { + o.VlanAssignments = v +} + +func (o PortVlanAssignmentList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PortVlanAssignmentList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.VlanAssignments) { + toSerialize["vlan_assignments"] = o.VlanAssignments + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PortVlanAssignmentList) UnmarshalJSON(data []byte) (err error) { + varPortVlanAssignmentList := _PortVlanAssignmentList{} + + err = json.Unmarshal(data, &varPortVlanAssignmentList) + + if err != nil { + return err + } + + *o = PortVlanAssignmentList(varPortVlanAssignmentList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "vlan_assignments") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePortVlanAssignmentList struct { + value *PortVlanAssignmentList + isSet bool +} + +func (v NullablePortVlanAssignmentList) Get() *PortVlanAssignmentList { + return v.value +} + +func (v *NullablePortVlanAssignmentList) Set(val *PortVlanAssignmentList) { + v.value = val + v.isSet = true +} + +func (v NullablePortVlanAssignmentList) IsSet() bool { + return v.isSet +} + +func (v *NullablePortVlanAssignmentList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortVlanAssignmentList(val *PortVlanAssignmentList) *NullablePortVlanAssignmentList { + return &NullablePortVlanAssignmentList{value: val, isSet: true} +} + +func (v NullablePortVlanAssignmentList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortVlanAssignmentList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_state.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_state.go new file mode 100644 index 00000000..3497cb71 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_port_vlan_assignment_state.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// PortVlanAssignmentState the model 'PortVlanAssignmentState' +type PortVlanAssignmentState string + +// List of PortVlanAssignment_state +const ( + PORTVLANASSIGNMENTSTATE_ASSIGNED PortVlanAssignmentState = "assigned" + PORTVLANASSIGNMENTSTATE_UNASSIGNING PortVlanAssignmentState = "unassigning" +) + +// All allowed values of PortVlanAssignmentState enum +var AllowedPortVlanAssignmentStateEnumValues = []PortVlanAssignmentState{ + "assigned", + "unassigning", +} + +func (v *PortVlanAssignmentState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := PortVlanAssignmentState(value) + for _, existing := range AllowedPortVlanAssignmentStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PortVlanAssignmentState", value) +} + +// NewPortVlanAssignmentStateFromValue returns a pointer to a valid PortVlanAssignmentState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPortVlanAssignmentStateFromValue(v string) (*PortVlanAssignmentState, error) { + ev := PortVlanAssignmentState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PortVlanAssignmentState: valid values are %v", v, AllowedPortVlanAssignmentStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PortVlanAssignmentState) IsValid() bool { + for _, existing := range AllowedPortVlanAssignmentStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to PortVlanAssignment_state value +func (v PortVlanAssignmentState) Ptr() *PortVlanAssignmentState { + return &v +} + +type NullablePortVlanAssignmentState struct { + value *PortVlanAssignmentState + isSet bool +} + +func (v NullablePortVlanAssignmentState) Get() *PortVlanAssignmentState { + return v.value +} + +func (v *NullablePortVlanAssignmentState) Set(val *PortVlanAssignmentState) { + v.value = val + v.isSet = true +} + +func (v NullablePortVlanAssignmentState) IsSet() bool { + return v.isSet +} + +func (v *NullablePortVlanAssignmentState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortVlanAssignmentState(val *PortVlanAssignmentState) *NullablePortVlanAssignmentState { + return &NullablePortVlanAssignmentState{value: val, isSet: true} +} + +func (v NullablePortVlanAssignmentState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortVlanAssignmentState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project.go new file mode 100644 index 00000000..a3a2ff34 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project.go @@ -0,0 +1,822 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the Project type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Project{} + +// Project struct for Project +type Project struct { + BgpConfig *Href `json:"bgp_config,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Devices []Href `json:"devices,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Invitations []Href `json:"invitations,omitempty"` + MaxDevices map[string]interface{} `json:"max_devices,omitempty"` + Members []Href `json:"members,omitempty"` + Memberships []Href `json:"memberships,omitempty"` + // The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis. + Name *string `json:"name,omitempty"` + NetworkStatus map[string]interface{} `json:"network_status,omitempty"` + Organization *Organization `json:"organization,omitempty"` + PaymentMethod *Href `json:"payment_method,omitempty"` + SshKeys []Href `json:"ssh_keys,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + Volumes []Href `json:"volumes,omitempty"` + Type *ProjectType `json:"type,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Project Project + +// NewProject instantiates a new Project object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProject() *Project { + this := Project{} + return &this +} + +// NewProjectWithDefaults instantiates a new Project object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectWithDefaults() *Project { + this := Project{} + return &this +} + +// GetBgpConfig returns the BgpConfig field value if set, zero value otherwise. +func (o *Project) GetBgpConfig() Href { + if o == nil || IsNil(o.BgpConfig) { + var ret Href + return ret + } + return *o.BgpConfig +} + +// GetBgpConfigOk returns a tuple with the BgpConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetBgpConfigOk() (*Href, bool) { + if o == nil || IsNil(o.BgpConfig) { + return nil, false + } + return o.BgpConfig, true +} + +// HasBgpConfig returns a boolean if a field has been set. +func (o *Project) HasBgpConfig() bool { + if o != nil && !IsNil(o.BgpConfig) { + return true + } + + return false +} + +// SetBgpConfig gets a reference to the given Href and assigns it to the BgpConfig field. +func (o *Project) SetBgpConfig(v Href) { + o.BgpConfig = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Project) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Project) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Project) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *Project) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *Project) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *Project) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDevices returns the Devices field value if set, zero value otherwise. +func (o *Project) GetDevices() []Href { + if o == nil || IsNil(o.Devices) { + var ret []Href + return ret + } + return o.Devices +} + +// GetDevicesOk returns a tuple with the Devices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetDevicesOk() ([]Href, bool) { + if o == nil || IsNil(o.Devices) { + return nil, false + } + return o.Devices, true +} + +// HasDevices returns a boolean if a field has been set. +func (o *Project) HasDevices() bool { + if o != nil && !IsNil(o.Devices) { + return true + } + + return false +} + +// SetDevices gets a reference to the given []Href and assigns it to the Devices field. +func (o *Project) SetDevices(v []Href) { + o.Devices = v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Project) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *Project) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Project) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Project) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Project) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Project) SetId(v string) { + o.Id = &v +} + +// GetInvitations returns the Invitations field value if set, zero value otherwise. +func (o *Project) GetInvitations() []Href { + if o == nil || IsNil(o.Invitations) { + var ret []Href + return ret + } + return o.Invitations +} + +// GetInvitationsOk returns a tuple with the Invitations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetInvitationsOk() ([]Href, bool) { + if o == nil || IsNil(o.Invitations) { + return nil, false + } + return o.Invitations, true +} + +// HasInvitations returns a boolean if a field has been set. +func (o *Project) HasInvitations() bool { + if o != nil && !IsNil(o.Invitations) { + return true + } + + return false +} + +// SetInvitations gets a reference to the given []Href and assigns it to the Invitations field. +func (o *Project) SetInvitations(v []Href) { + o.Invitations = v +} + +// GetMaxDevices returns the MaxDevices field value if set, zero value otherwise. +func (o *Project) GetMaxDevices() map[string]interface{} { + if o == nil || IsNil(o.MaxDevices) { + var ret map[string]interface{} + return ret + } + return o.MaxDevices +} + +// GetMaxDevicesOk returns a tuple with the MaxDevices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetMaxDevicesOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.MaxDevices) { + return map[string]interface{}{}, false + } + return o.MaxDevices, true +} + +// HasMaxDevices returns a boolean if a field has been set. +func (o *Project) HasMaxDevices() bool { + if o != nil && !IsNil(o.MaxDevices) { + return true + } + + return false +} + +// SetMaxDevices gets a reference to the given map[string]interface{} and assigns it to the MaxDevices field. +func (o *Project) SetMaxDevices(v map[string]interface{}) { + o.MaxDevices = v +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *Project) GetMembers() []Href { + if o == nil || IsNil(o.Members) { + var ret []Href + return ret + } + return o.Members +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetMembersOk() ([]Href, bool) { + if o == nil || IsNil(o.Members) { + return nil, false + } + return o.Members, true +} + +// HasMembers returns a boolean if a field has been set. +func (o *Project) HasMembers() bool { + if o != nil && !IsNil(o.Members) { + return true + } + + return false +} + +// SetMembers gets a reference to the given []Href and assigns it to the Members field. +func (o *Project) SetMembers(v []Href) { + o.Members = v +} + +// GetMemberships returns the Memberships field value if set, zero value otherwise. +func (o *Project) GetMemberships() []Href { + if o == nil || IsNil(o.Memberships) { + var ret []Href + return ret + } + return o.Memberships +} + +// GetMembershipsOk returns a tuple with the Memberships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetMembershipsOk() ([]Href, bool) { + if o == nil || IsNil(o.Memberships) { + return nil, false + } + return o.Memberships, true +} + +// HasMemberships returns a boolean if a field has been set. +func (o *Project) HasMemberships() bool { + if o != nil && !IsNil(o.Memberships) { + return true + } + + return false +} + +// SetMemberships gets a reference to the given []Href and assigns it to the Memberships field. +func (o *Project) SetMemberships(v []Href) { + o.Memberships = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Project) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Project) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Project) SetName(v string) { + o.Name = &v +} + +// GetNetworkStatus returns the NetworkStatus field value if set, zero value otherwise. +func (o *Project) GetNetworkStatus() map[string]interface{} { + if o == nil || IsNil(o.NetworkStatus) { + var ret map[string]interface{} + return ret + } + return o.NetworkStatus +} + +// GetNetworkStatusOk returns a tuple with the NetworkStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetNetworkStatusOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.NetworkStatus) { + return map[string]interface{}{}, false + } + return o.NetworkStatus, true +} + +// HasNetworkStatus returns a boolean if a field has been set. +func (o *Project) HasNetworkStatus() bool { + if o != nil && !IsNil(o.NetworkStatus) { + return true + } + + return false +} + +// SetNetworkStatus gets a reference to the given map[string]interface{} and assigns it to the NetworkStatus field. +func (o *Project) SetNetworkStatus(v map[string]interface{}) { + o.NetworkStatus = v +} + +// GetOrganization returns the Organization field value if set, zero value otherwise. +func (o *Project) GetOrganization() Organization { + if o == nil || IsNil(o.Organization) { + var ret Organization + return ret + } + return *o.Organization +} + +// GetOrganizationOk returns a tuple with the Organization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetOrganizationOk() (*Organization, bool) { + if o == nil || IsNil(o.Organization) { + return nil, false + } + return o.Organization, true +} + +// HasOrganization returns a boolean if a field has been set. +func (o *Project) HasOrganization() bool { + if o != nil && !IsNil(o.Organization) { + return true + } + + return false +} + +// SetOrganization gets a reference to the given Organization and assigns it to the Organization field. +func (o *Project) SetOrganization(v Organization) { + o.Organization = &v +} + +// GetPaymentMethod returns the PaymentMethod field value if set, zero value otherwise. +func (o *Project) GetPaymentMethod() Href { + if o == nil || IsNil(o.PaymentMethod) { + var ret Href + return ret + } + return *o.PaymentMethod +} + +// GetPaymentMethodOk returns a tuple with the PaymentMethod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetPaymentMethodOk() (*Href, bool) { + if o == nil || IsNil(o.PaymentMethod) { + return nil, false + } + return o.PaymentMethod, true +} + +// HasPaymentMethod returns a boolean if a field has been set. +func (o *Project) HasPaymentMethod() bool { + if o != nil && !IsNil(o.PaymentMethod) { + return true + } + + return false +} + +// SetPaymentMethod gets a reference to the given Href and assigns it to the PaymentMethod field. +func (o *Project) SetPaymentMethod(v Href) { + o.PaymentMethod = &v +} + +// GetSshKeys returns the SshKeys field value if set, zero value otherwise. +func (o *Project) GetSshKeys() []Href { + if o == nil || IsNil(o.SshKeys) { + var ret []Href + return ret + } + return o.SshKeys +} + +// GetSshKeysOk returns a tuple with the SshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetSshKeysOk() ([]Href, bool) { + if o == nil || IsNil(o.SshKeys) { + return nil, false + } + return o.SshKeys, true +} + +// HasSshKeys returns a boolean if a field has been set. +func (o *Project) HasSshKeys() bool { + if o != nil && !IsNil(o.SshKeys) { + return true + } + + return false +} + +// SetSshKeys gets a reference to the given []Href and assigns it to the SshKeys field. +func (o *Project) SetSshKeys(v []Href) { + o.SshKeys = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Project) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Project) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Project) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *Project) GetVolumes() []Href { + if o == nil || IsNil(o.Volumes) { + var ret []Href + return ret + } + return o.Volumes +} + +// GetVolumesOk returns a tuple with the Volumes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetVolumesOk() ([]Href, bool) { + if o == nil || IsNil(o.Volumes) { + return nil, false + } + return o.Volumes, true +} + +// HasVolumes returns a boolean if a field has been set. +func (o *Project) HasVolumes() bool { + if o != nil && !IsNil(o.Volumes) { + return true + } + + return false +} + +// SetVolumes gets a reference to the given []Href and assigns it to the Volumes field. +func (o *Project) SetVolumes(v []Href) { + o.Volumes = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Project) GetType() ProjectType { + if o == nil || IsNil(o.Type) { + var ret ProjectType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetTypeOk() (*ProjectType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Project) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given ProjectType and assigns it to the Type field. +func (o *Project) SetType(v ProjectType) { + o.Type = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Project) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *Project) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *Project) SetTags(v []string) { + o.Tags = v +} + +func (o Project) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Project) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BgpConfig) { + toSerialize["bgp_config"] = o.BgpConfig + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Devices) { + toSerialize["devices"] = o.Devices + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Invitations) { + toSerialize["invitations"] = o.Invitations + } + if !IsNil(o.MaxDevices) { + toSerialize["max_devices"] = o.MaxDevices + } + if !IsNil(o.Members) { + toSerialize["members"] = o.Members + } + if !IsNil(o.Memberships) { + toSerialize["memberships"] = o.Memberships + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.NetworkStatus) { + toSerialize["network_status"] = o.NetworkStatus + } + if !IsNil(o.Organization) { + toSerialize["organization"] = o.Organization + } + if !IsNil(o.PaymentMethod) { + toSerialize["payment_method"] = o.PaymentMethod + } + if !IsNil(o.SshKeys) { + toSerialize["ssh_keys"] = o.SshKeys + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Volumes) { + toSerialize["volumes"] = o.Volumes + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Project) UnmarshalJSON(data []byte) (err error) { + varProject := _Project{} + + err = json.Unmarshal(data, &varProject) + + if err != nil { + return err + } + + *o = Project(varProject) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bgp_config") + delete(additionalProperties, "created_at") + delete(additionalProperties, "customdata") + delete(additionalProperties, "devices") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "invitations") + delete(additionalProperties, "max_devices") + delete(additionalProperties, "members") + delete(additionalProperties, "memberships") + delete(additionalProperties, "name") + delete(additionalProperties, "network_status") + delete(additionalProperties, "organization") + delete(additionalProperties, "payment_method") + delete(additionalProperties, "ssh_keys") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "volumes") + delete(additionalProperties, "type") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProject struct { + value *Project + isSet bool +} + +func (v NullableProject) Get() *Project { + return v.value +} + +func (v *NullableProject) Set(val *Project) { + v.value = val + v.isSet = true +} + +func (v NullableProject) IsSet() bool { + return v.isSet +} + +func (v *NullableProject) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProject(val *Project) *NullableProject { + return &NullableProject{value: val, isSet: true} +} + +func (v NullableProject) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProject) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_from_root_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_from_root_input.go new file mode 100644 index 00000000..7cdfa6db --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_from_root_input.go @@ -0,0 +1,353 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the ProjectCreateFromRootInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProjectCreateFromRootInput{} + +// ProjectCreateFromRootInput struct for ProjectCreateFromRootInput +type ProjectCreateFromRootInput struct { + Customdata map[string]interface{} `json:"customdata,omitempty"` + // The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis. + Name string `json:"name"` + OrganizationId *string `json:"organization_id,omitempty"` + PaymentMethodId *string `json:"payment_method_id,omitempty"` + Type *ProjectCreateFromRootInputType `json:"type,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ProjectCreateFromRootInput ProjectCreateFromRootInput + +// NewProjectCreateFromRootInput instantiates a new ProjectCreateFromRootInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProjectCreateFromRootInput(name string) *ProjectCreateFromRootInput { + this := ProjectCreateFromRootInput{} + this.Name = name + return &this +} + +// NewProjectCreateFromRootInputWithDefaults instantiates a new ProjectCreateFromRootInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectCreateFromRootInputWithDefaults() *ProjectCreateFromRootInput { + this := ProjectCreateFromRootInput{} + return &this +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *ProjectCreateFromRootInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectCreateFromRootInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *ProjectCreateFromRootInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *ProjectCreateFromRootInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetName returns the Name field value +func (o *ProjectCreateFromRootInput) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ProjectCreateFromRootInput) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ProjectCreateFromRootInput) SetName(v string) { + o.Name = v +} + +// GetOrganizationId returns the OrganizationId field value if set, zero value otherwise. +func (o *ProjectCreateFromRootInput) GetOrganizationId() string { + if o == nil || IsNil(o.OrganizationId) { + var ret string + return ret + } + return *o.OrganizationId +} + +// GetOrganizationIdOk returns a tuple with the OrganizationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectCreateFromRootInput) GetOrganizationIdOk() (*string, bool) { + if o == nil || IsNil(o.OrganizationId) { + return nil, false + } + return o.OrganizationId, true +} + +// HasOrganizationId returns a boolean if a field has been set. +func (o *ProjectCreateFromRootInput) HasOrganizationId() bool { + if o != nil && !IsNil(o.OrganizationId) { + return true + } + + return false +} + +// SetOrganizationId gets a reference to the given string and assigns it to the OrganizationId field. +func (o *ProjectCreateFromRootInput) SetOrganizationId(v string) { + o.OrganizationId = &v +} + +// GetPaymentMethodId returns the PaymentMethodId field value if set, zero value otherwise. +func (o *ProjectCreateFromRootInput) GetPaymentMethodId() string { + if o == nil || IsNil(o.PaymentMethodId) { + var ret string + return ret + } + return *o.PaymentMethodId +} + +// GetPaymentMethodIdOk returns a tuple with the PaymentMethodId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectCreateFromRootInput) GetPaymentMethodIdOk() (*string, bool) { + if o == nil || IsNil(o.PaymentMethodId) { + return nil, false + } + return o.PaymentMethodId, true +} + +// HasPaymentMethodId returns a boolean if a field has been set. +func (o *ProjectCreateFromRootInput) HasPaymentMethodId() bool { + if o != nil && !IsNil(o.PaymentMethodId) { + return true + } + + return false +} + +// SetPaymentMethodId gets a reference to the given string and assigns it to the PaymentMethodId field. +func (o *ProjectCreateFromRootInput) SetPaymentMethodId(v string) { + o.PaymentMethodId = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ProjectCreateFromRootInput) GetType() ProjectCreateFromRootInputType { + if o == nil || IsNil(o.Type) { + var ret ProjectCreateFromRootInputType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectCreateFromRootInput) GetTypeOk() (*ProjectCreateFromRootInputType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ProjectCreateFromRootInput) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given ProjectCreateFromRootInputType and assigns it to the Type field. +func (o *ProjectCreateFromRootInput) SetType(v ProjectCreateFromRootInputType) { + o.Type = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *ProjectCreateFromRootInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectCreateFromRootInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *ProjectCreateFromRootInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *ProjectCreateFromRootInput) SetTags(v []string) { + o.Tags = v +} + +func (o ProjectCreateFromRootInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProjectCreateFromRootInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + toSerialize["name"] = o.Name + if !IsNil(o.OrganizationId) { + toSerialize["organization_id"] = o.OrganizationId + } + if !IsNil(o.PaymentMethodId) { + toSerialize["payment_method_id"] = o.PaymentMethodId + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProjectCreateFromRootInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varProjectCreateFromRootInput := _ProjectCreateFromRootInput{} + + err = json.Unmarshal(data, &varProjectCreateFromRootInput) + + if err != nil { + return err + } + + *o = ProjectCreateFromRootInput(varProjectCreateFromRootInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "customdata") + delete(additionalProperties, "name") + delete(additionalProperties, "organization_id") + delete(additionalProperties, "payment_method_id") + delete(additionalProperties, "type") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProjectCreateFromRootInput struct { + value *ProjectCreateFromRootInput + isSet bool +} + +func (v NullableProjectCreateFromRootInput) Get() *ProjectCreateFromRootInput { + return v.value +} + +func (v *NullableProjectCreateFromRootInput) Set(val *ProjectCreateFromRootInput) { + v.value = val + v.isSet = true +} + +func (v NullableProjectCreateFromRootInput) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectCreateFromRootInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectCreateFromRootInput(val *ProjectCreateFromRootInput) *NullableProjectCreateFromRootInput { + return &NullableProjectCreateFromRootInput{value: val, isSet: true} +} + +func (v NullableProjectCreateFromRootInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectCreateFromRootInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_from_root_input_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_from_root_input_type.go new file mode 100644 index 00000000..a9fbbedd --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_from_root_input_type.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// ProjectCreateFromRootInputType The type of the project. If no type is specified the project type will automatically be `default` Projects of type 'vmce' are part of an in development feature and not available to all customers. +type ProjectCreateFromRootInputType string + +// List of ProjectCreateFromRootInput_type +const ( + PROJECTCREATEFROMROOTINPUTTYPE_DEFAULT ProjectCreateFromRootInputType = "default" + PROJECTCREATEFROMROOTINPUTTYPE_VMCE ProjectCreateFromRootInputType = "vmce" +) + +// All allowed values of ProjectCreateFromRootInputType enum +var AllowedProjectCreateFromRootInputTypeEnumValues = []ProjectCreateFromRootInputType{ + "default", + "vmce", +} + +func (v *ProjectCreateFromRootInputType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ProjectCreateFromRootInputType(value) + for _, existing := range AllowedProjectCreateFromRootInputTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ProjectCreateFromRootInputType", value) +} + +// NewProjectCreateFromRootInputTypeFromValue returns a pointer to a valid ProjectCreateFromRootInputType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewProjectCreateFromRootInputTypeFromValue(v string) (*ProjectCreateFromRootInputType, error) { + ev := ProjectCreateFromRootInputType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ProjectCreateFromRootInputType: valid values are %v", v, AllowedProjectCreateFromRootInputTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ProjectCreateFromRootInputType) IsValid() bool { + for _, existing := range AllowedProjectCreateFromRootInputTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ProjectCreateFromRootInput_type value +func (v ProjectCreateFromRootInputType) Ptr() *ProjectCreateFromRootInputType { + return &v +} + +type NullableProjectCreateFromRootInputType struct { + value *ProjectCreateFromRootInputType + isSet bool +} + +func (v NullableProjectCreateFromRootInputType) Get() *ProjectCreateFromRootInputType { + return v.value +} + +func (v *NullableProjectCreateFromRootInputType) Set(val *ProjectCreateFromRootInputType) { + v.value = val + v.isSet = true +} + +func (v NullableProjectCreateFromRootInputType) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectCreateFromRootInputType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectCreateFromRootInputType(val *ProjectCreateFromRootInputType) *NullableProjectCreateFromRootInputType { + return &NullableProjectCreateFromRootInputType{value: val, isSet: true} +} + +func (v NullableProjectCreateFromRootInputType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectCreateFromRootInputType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_input.go new file mode 100644 index 00000000..91862ec1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_create_input.go @@ -0,0 +1,316 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the ProjectCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProjectCreateInput{} + +// ProjectCreateInput struct for ProjectCreateInput +type ProjectCreateInput struct { + Customdata map[string]interface{} `json:"customdata,omitempty"` + // The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis. + Name string `json:"name"` + PaymentMethodId *string `json:"payment_method_id,omitempty"` + Type *ProjectCreateFromRootInputType `json:"type,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ProjectCreateInput ProjectCreateInput + +// NewProjectCreateInput instantiates a new ProjectCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProjectCreateInput(name string) *ProjectCreateInput { + this := ProjectCreateInput{} + this.Name = name + return &this +} + +// NewProjectCreateInputWithDefaults instantiates a new ProjectCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectCreateInputWithDefaults() *ProjectCreateInput { + this := ProjectCreateInput{} + return &this +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *ProjectCreateInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectCreateInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *ProjectCreateInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *ProjectCreateInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetName returns the Name field value +func (o *ProjectCreateInput) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ProjectCreateInput) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ProjectCreateInput) SetName(v string) { + o.Name = v +} + +// GetPaymentMethodId returns the PaymentMethodId field value if set, zero value otherwise. +func (o *ProjectCreateInput) GetPaymentMethodId() string { + if o == nil || IsNil(o.PaymentMethodId) { + var ret string + return ret + } + return *o.PaymentMethodId +} + +// GetPaymentMethodIdOk returns a tuple with the PaymentMethodId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectCreateInput) GetPaymentMethodIdOk() (*string, bool) { + if o == nil || IsNil(o.PaymentMethodId) { + return nil, false + } + return o.PaymentMethodId, true +} + +// HasPaymentMethodId returns a boolean if a field has been set. +func (o *ProjectCreateInput) HasPaymentMethodId() bool { + if o != nil && !IsNil(o.PaymentMethodId) { + return true + } + + return false +} + +// SetPaymentMethodId gets a reference to the given string and assigns it to the PaymentMethodId field. +func (o *ProjectCreateInput) SetPaymentMethodId(v string) { + o.PaymentMethodId = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ProjectCreateInput) GetType() ProjectCreateFromRootInputType { + if o == nil || IsNil(o.Type) { + var ret ProjectCreateFromRootInputType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectCreateInput) GetTypeOk() (*ProjectCreateFromRootInputType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ProjectCreateInput) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given ProjectCreateFromRootInputType and assigns it to the Type field. +func (o *ProjectCreateInput) SetType(v ProjectCreateFromRootInputType) { + o.Type = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *ProjectCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *ProjectCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *ProjectCreateInput) SetTags(v []string) { + o.Tags = v +} + +func (o ProjectCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProjectCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + toSerialize["name"] = o.Name + if !IsNil(o.PaymentMethodId) { + toSerialize["payment_method_id"] = o.PaymentMethodId + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProjectCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varProjectCreateInput := _ProjectCreateInput{} + + err = json.Unmarshal(data, &varProjectCreateInput) + + if err != nil { + return err + } + + *o = ProjectCreateInput(varProjectCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "customdata") + delete(additionalProperties, "name") + delete(additionalProperties, "payment_method_id") + delete(additionalProperties, "type") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProjectCreateInput struct { + value *ProjectCreateInput + isSet bool +} + +func (v NullableProjectCreateInput) Get() *ProjectCreateInput { + return v.value +} + +func (v *NullableProjectCreateInput) Set(val *ProjectCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableProjectCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectCreateInput(val *ProjectCreateInput) *NullableProjectCreateInput { + return &NullableProjectCreateInput{value: val, isSet: true} +} + +func (v NullableProjectCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_id_name.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_id_name.go new file mode 100644 index 00000000..543f8a64 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_id_name.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the ProjectIdName type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProjectIdName{} + +// ProjectIdName struct for ProjectIdName +type ProjectIdName struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ProjectIdName ProjectIdName + +// NewProjectIdName instantiates a new ProjectIdName object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProjectIdName() *ProjectIdName { + this := ProjectIdName{} + return &this +} + +// NewProjectIdNameWithDefaults instantiates a new ProjectIdName object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectIdNameWithDefaults() *ProjectIdName { + this := ProjectIdName{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ProjectIdName) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectIdName) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ProjectIdName) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ProjectIdName) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ProjectIdName) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectIdName) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ProjectIdName) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ProjectIdName) SetName(v string) { + o.Name = &v +} + +func (o ProjectIdName) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProjectIdName) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProjectIdName) UnmarshalJSON(data []byte) (err error) { + varProjectIdName := _ProjectIdName{} + + err = json.Unmarshal(data, &varProjectIdName) + + if err != nil { + return err + } + + *o = ProjectIdName(varProjectIdName) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProjectIdName struct { + value *ProjectIdName + isSet bool +} + +func (v NullableProjectIdName) Get() *ProjectIdName { + return v.value +} + +func (v *NullableProjectIdName) Set(val *ProjectIdName) { + v.value = val + v.isSet = true +} + +func (v NullableProjectIdName) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectIdName) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectIdName(val *ProjectIdName) *NullableProjectIdName { + return &NullableProjectIdName{value: val, isSet: true} +} + +func (v NullableProjectIdName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectIdName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_list.go new file mode 100644 index 00000000..5a5ab3ed --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_list.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the ProjectList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProjectList{} + +// ProjectList struct for ProjectList +type ProjectList struct { + Meta *Meta `json:"meta,omitempty"` + Projects []Project `json:"projects,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ProjectList ProjectList + +// NewProjectList instantiates a new ProjectList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProjectList() *ProjectList { + this := ProjectList{} + return &this +} + +// NewProjectListWithDefaults instantiates a new ProjectList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectListWithDefaults() *ProjectList { + this := ProjectList{} + return &this +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *ProjectList) GetMeta() Meta { + if o == nil || IsNil(o.Meta) { + var ret Meta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectList) GetMetaOk() (*Meta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *ProjectList) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given Meta and assigns it to the Meta field. +func (o *ProjectList) SetMeta(v Meta) { + o.Meta = &v +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *ProjectList) GetProjects() []Project { + if o == nil || IsNil(o.Projects) { + var ret []Project + return ret + } + return o.Projects +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectList) GetProjectsOk() ([]Project, bool) { + if o == nil || IsNil(o.Projects) { + return nil, false + } + return o.Projects, true +} + +// HasProjects returns a boolean if a field has been set. +func (o *ProjectList) HasProjects() bool { + if o != nil && !IsNil(o.Projects) { + return true + } + + return false +} + +// SetProjects gets a reference to the given []Project and assigns it to the Projects field. +func (o *ProjectList) SetProjects(v []Project) { + o.Projects = v +} + +func (o ProjectList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProjectList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + if !IsNil(o.Projects) { + toSerialize["projects"] = o.Projects + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProjectList) UnmarshalJSON(data []byte) (err error) { + varProjectList := _ProjectList{} + + err = json.Unmarshal(data, &varProjectList) + + if err != nil { + return err + } + + *o = ProjectList(varProjectList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "meta") + delete(additionalProperties, "projects") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProjectList struct { + value *ProjectList + isSet bool +} + +func (v NullableProjectList) Get() *ProjectList { + return v.value +} + +func (v *NullableProjectList) Set(val *ProjectList) { + v.value = val + v.isSet = true +} + +func (v NullableProjectList) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectList(val *ProjectList) *NullableProjectList { + return &NullableProjectList{value: val, isSet: true} +} + +func (v NullableProjectList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_type.go new file mode 100644 index 00000000..31b608d3 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_type.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// ProjectType The type of the project. Projects of type `vmce` are part of an in development feature and not available to all customers. +type ProjectType string + +// List of Project_type +const ( + PROJECTTYPE_DEFAULT ProjectType = "default" + PROJECTTYPE_VMCE ProjectType = "vmce" +) + +// All allowed values of ProjectType enum +var AllowedProjectTypeEnumValues = []ProjectType{ + "default", + "vmce", +} + +func (v *ProjectType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ProjectType(value) + for _, existing := range AllowedProjectTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ProjectType", value) +} + +// NewProjectTypeFromValue returns a pointer to a valid ProjectType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewProjectTypeFromValue(v string) (*ProjectType, error) { + ev := ProjectType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ProjectType: valid values are %v", v, AllowedProjectTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ProjectType) IsValid() bool { + for _, existing := range AllowedProjectTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Project_type value +func (v ProjectType) Ptr() *ProjectType { + return &v +} + +type NullableProjectType struct { + value *ProjectType + isSet bool +} + +func (v NullableProjectType) Get() *ProjectType { + return v.value +} + +func (v *NullableProjectType) Set(val *ProjectType) { + v.value = val + v.isSet = true +} + +func (v NullableProjectType) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectType(val *ProjectType) *NullableProjectType { + return &NullableProjectType{value: val, isSet: true} +} + +func (v NullableProjectType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_update_input.go new file mode 100644 index 00000000..8b801591 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_update_input.go @@ -0,0 +1,303 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the ProjectUpdateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProjectUpdateInput{} + +// ProjectUpdateInput struct for ProjectUpdateInput +type ProjectUpdateInput struct { + BackendTransferEnabled *bool `json:"backend_transfer_enabled,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + // The name of the project. Cannot contain characters encoded in greater than 3 bytes such as emojis. + Name *string `json:"name,omitempty"` + PaymentMethodId *string `json:"payment_method_id,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ProjectUpdateInput ProjectUpdateInput + +// NewProjectUpdateInput instantiates a new ProjectUpdateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProjectUpdateInput() *ProjectUpdateInput { + this := ProjectUpdateInput{} + return &this +} + +// NewProjectUpdateInputWithDefaults instantiates a new ProjectUpdateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectUpdateInputWithDefaults() *ProjectUpdateInput { + this := ProjectUpdateInput{} + return &this +} + +// GetBackendTransferEnabled returns the BackendTransferEnabled field value if set, zero value otherwise. +func (o *ProjectUpdateInput) GetBackendTransferEnabled() bool { + if o == nil || IsNil(o.BackendTransferEnabled) { + var ret bool + return ret + } + return *o.BackendTransferEnabled +} + +// GetBackendTransferEnabledOk returns a tuple with the BackendTransferEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUpdateInput) GetBackendTransferEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.BackendTransferEnabled) { + return nil, false + } + return o.BackendTransferEnabled, true +} + +// HasBackendTransferEnabled returns a boolean if a field has been set. +func (o *ProjectUpdateInput) HasBackendTransferEnabled() bool { + if o != nil && !IsNil(o.BackendTransferEnabled) { + return true + } + + return false +} + +// SetBackendTransferEnabled gets a reference to the given bool and assigns it to the BackendTransferEnabled field. +func (o *ProjectUpdateInput) SetBackendTransferEnabled(v bool) { + o.BackendTransferEnabled = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *ProjectUpdateInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUpdateInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *ProjectUpdateInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *ProjectUpdateInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ProjectUpdateInput) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUpdateInput) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ProjectUpdateInput) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ProjectUpdateInput) SetName(v string) { + o.Name = &v +} + +// GetPaymentMethodId returns the PaymentMethodId field value if set, zero value otherwise. +func (o *ProjectUpdateInput) GetPaymentMethodId() string { + if o == nil || IsNil(o.PaymentMethodId) { + var ret string + return ret + } + return *o.PaymentMethodId +} + +// GetPaymentMethodIdOk returns a tuple with the PaymentMethodId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUpdateInput) GetPaymentMethodIdOk() (*string, bool) { + if o == nil || IsNil(o.PaymentMethodId) { + return nil, false + } + return o.PaymentMethodId, true +} + +// HasPaymentMethodId returns a boolean if a field has been set. +func (o *ProjectUpdateInput) HasPaymentMethodId() bool { + if o != nil && !IsNil(o.PaymentMethodId) { + return true + } + + return false +} + +// SetPaymentMethodId gets a reference to the given string and assigns it to the PaymentMethodId field. +func (o *ProjectUpdateInput) SetPaymentMethodId(v string) { + o.PaymentMethodId = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *ProjectUpdateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUpdateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *ProjectUpdateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *ProjectUpdateInput) SetTags(v []string) { + o.Tags = v +} + +func (o ProjectUpdateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProjectUpdateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BackendTransferEnabled) { + toSerialize["backend_transfer_enabled"] = o.BackendTransferEnabled + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.PaymentMethodId) { + toSerialize["payment_method_id"] = o.PaymentMethodId + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProjectUpdateInput) UnmarshalJSON(data []byte) (err error) { + varProjectUpdateInput := _ProjectUpdateInput{} + + err = json.Unmarshal(data, &varProjectUpdateInput) + + if err != nil { + return err + } + + *o = ProjectUpdateInput(varProjectUpdateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "backend_transfer_enabled") + delete(additionalProperties, "customdata") + delete(additionalProperties, "name") + delete(additionalProperties, "payment_method_id") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProjectUpdateInput struct { + value *ProjectUpdateInput + isSet bool +} + +func (v NullableProjectUpdateInput) Get() *ProjectUpdateInput { + return v.value +} + +func (v *NullableProjectUpdateInput) Set(val *ProjectUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullableProjectUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectUpdateInput(val *ProjectUpdateInput) *NullableProjectUpdateInput { + return &NullableProjectUpdateInput{value: val, isSet: true} +} + +func (v NullableProjectUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_usage.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_usage.go new file mode 100644 index 00000000..f1ba046c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_usage.go @@ -0,0 +1,450 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the ProjectUsage type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProjectUsage{} + +// ProjectUsage struct for ProjectUsage +type ProjectUsage struct { + Facility *string `json:"facility,omitempty"` + Name *string `json:"name,omitempty"` + Plan *string `json:"plan,omitempty"` + PlanVersion *string `json:"plan_version,omitempty"` + Price *string `json:"price,omitempty"` + Quantity *string `json:"quantity,omitempty"` + Total *string `json:"total,omitempty"` + Type *string `json:"type,omitempty"` + Unit *string `json:"unit,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ProjectUsage ProjectUsage + +// NewProjectUsage instantiates a new ProjectUsage object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProjectUsage() *ProjectUsage { + this := ProjectUsage{} + return &this +} + +// NewProjectUsageWithDefaults instantiates a new ProjectUsage object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectUsageWithDefaults() *ProjectUsage { + this := ProjectUsage{} + return &this +} + +// GetFacility returns the Facility field value if set, zero value otherwise. +func (o *ProjectUsage) GetFacility() string { + if o == nil || IsNil(o.Facility) { + var ret string + return ret + } + return *o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUsage) GetFacilityOk() (*string, bool) { + if o == nil || IsNil(o.Facility) { + return nil, false + } + return o.Facility, true +} + +// HasFacility returns a boolean if a field has been set. +func (o *ProjectUsage) HasFacility() bool { + if o != nil && !IsNil(o.Facility) { + return true + } + + return false +} + +// SetFacility gets a reference to the given string and assigns it to the Facility field. +func (o *ProjectUsage) SetFacility(v string) { + o.Facility = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ProjectUsage) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUsage) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ProjectUsage) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ProjectUsage) SetName(v string) { + o.Name = &v +} + +// GetPlan returns the Plan field value if set, zero value otherwise. +func (o *ProjectUsage) GetPlan() string { + if o == nil || IsNil(o.Plan) { + var ret string + return ret + } + return *o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUsage) GetPlanOk() (*string, bool) { + if o == nil || IsNil(o.Plan) { + return nil, false + } + return o.Plan, true +} + +// HasPlan returns a boolean if a field has been set. +func (o *ProjectUsage) HasPlan() bool { + if o != nil && !IsNil(o.Plan) { + return true + } + + return false +} + +// SetPlan gets a reference to the given string and assigns it to the Plan field. +func (o *ProjectUsage) SetPlan(v string) { + o.Plan = &v +} + +// GetPlanVersion returns the PlanVersion field value if set, zero value otherwise. +func (o *ProjectUsage) GetPlanVersion() string { + if o == nil || IsNil(o.PlanVersion) { + var ret string + return ret + } + return *o.PlanVersion +} + +// GetPlanVersionOk returns a tuple with the PlanVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUsage) GetPlanVersionOk() (*string, bool) { + if o == nil || IsNil(o.PlanVersion) { + return nil, false + } + return o.PlanVersion, true +} + +// HasPlanVersion returns a boolean if a field has been set. +func (o *ProjectUsage) HasPlanVersion() bool { + if o != nil && !IsNil(o.PlanVersion) { + return true + } + + return false +} + +// SetPlanVersion gets a reference to the given string and assigns it to the PlanVersion field. +func (o *ProjectUsage) SetPlanVersion(v string) { + o.PlanVersion = &v +} + +// GetPrice returns the Price field value if set, zero value otherwise. +func (o *ProjectUsage) GetPrice() string { + if o == nil || IsNil(o.Price) { + var ret string + return ret + } + return *o.Price +} + +// GetPriceOk returns a tuple with the Price field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUsage) GetPriceOk() (*string, bool) { + if o == nil || IsNil(o.Price) { + return nil, false + } + return o.Price, true +} + +// HasPrice returns a boolean if a field has been set. +func (o *ProjectUsage) HasPrice() bool { + if o != nil && !IsNil(o.Price) { + return true + } + + return false +} + +// SetPrice gets a reference to the given string and assigns it to the Price field. +func (o *ProjectUsage) SetPrice(v string) { + o.Price = &v +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *ProjectUsage) GetQuantity() string { + if o == nil || IsNil(o.Quantity) { + var ret string + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUsage) GetQuantityOk() (*string, bool) { + if o == nil || IsNil(o.Quantity) { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *ProjectUsage) HasQuantity() bool { + if o != nil && !IsNil(o.Quantity) { + return true + } + + return false +} + +// SetQuantity gets a reference to the given string and assigns it to the Quantity field. +func (o *ProjectUsage) SetQuantity(v string) { + o.Quantity = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *ProjectUsage) GetTotal() string { + if o == nil || IsNil(o.Total) { + var ret string + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUsage) GetTotalOk() (*string, bool) { + if o == nil || IsNil(o.Total) { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *ProjectUsage) HasTotal() bool { + if o != nil && !IsNil(o.Total) { + return true + } + + return false +} + +// SetTotal gets a reference to the given string and assigns it to the Total field. +func (o *ProjectUsage) SetTotal(v string) { + o.Total = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ProjectUsage) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUsage) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ProjectUsage) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ProjectUsage) SetType(v string) { + o.Type = &v +} + +// GetUnit returns the Unit field value if set, zero value otherwise. +func (o *ProjectUsage) GetUnit() string { + if o == nil || IsNil(o.Unit) { + var ret string + return ret + } + return *o.Unit +} + +// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUsage) GetUnitOk() (*string, bool) { + if o == nil || IsNil(o.Unit) { + return nil, false + } + return o.Unit, true +} + +// HasUnit returns a boolean if a field has been set. +func (o *ProjectUsage) HasUnit() bool { + if o != nil && !IsNil(o.Unit) { + return true + } + + return false +} + +// SetUnit gets a reference to the given string and assigns it to the Unit field. +func (o *ProjectUsage) SetUnit(v string) { + o.Unit = &v +} + +func (o ProjectUsage) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProjectUsage) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Facility) { + toSerialize["facility"] = o.Facility + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Plan) { + toSerialize["plan"] = o.Plan + } + if !IsNil(o.PlanVersion) { + toSerialize["plan_version"] = o.PlanVersion + } + if !IsNil(o.Price) { + toSerialize["price"] = o.Price + } + if !IsNil(o.Quantity) { + toSerialize["quantity"] = o.Quantity + } + if !IsNil(o.Total) { + toSerialize["total"] = o.Total + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Unit) { + toSerialize["unit"] = o.Unit + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProjectUsage) UnmarshalJSON(data []byte) (err error) { + varProjectUsage := _ProjectUsage{} + + err = json.Unmarshal(data, &varProjectUsage) + + if err != nil { + return err + } + + *o = ProjectUsage(varProjectUsage) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "facility") + delete(additionalProperties, "name") + delete(additionalProperties, "plan") + delete(additionalProperties, "plan_version") + delete(additionalProperties, "price") + delete(additionalProperties, "quantity") + delete(additionalProperties, "total") + delete(additionalProperties, "type") + delete(additionalProperties, "unit") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProjectUsage struct { + value *ProjectUsage + isSet bool +} + +func (v NullableProjectUsage) Get() *ProjectUsage { + return v.value +} + +func (v *NullableProjectUsage) Set(val *ProjectUsage) { + v.value = val + v.isSet = true +} + +func (v NullableProjectUsage) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectUsage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectUsage(val *ProjectUsage) *NullableProjectUsage { + return &NullableProjectUsage{value: val, isSet: true} +} + +func (v NullableProjectUsage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectUsage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_usage_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_usage_list.go new file mode 100644 index 00000000..1ee62f51 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_project_usage_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the ProjectUsageList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProjectUsageList{} + +// ProjectUsageList struct for ProjectUsageList +type ProjectUsageList struct { + Usages []ProjectUsage `json:"usages,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ProjectUsageList ProjectUsageList + +// NewProjectUsageList instantiates a new ProjectUsageList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProjectUsageList() *ProjectUsageList { + this := ProjectUsageList{} + return &this +} + +// NewProjectUsageListWithDefaults instantiates a new ProjectUsageList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectUsageListWithDefaults() *ProjectUsageList { + this := ProjectUsageList{} + return &this +} + +// GetUsages returns the Usages field value if set, zero value otherwise. +func (o *ProjectUsageList) GetUsages() []ProjectUsage { + if o == nil || IsNil(o.Usages) { + var ret []ProjectUsage + return ret + } + return o.Usages +} + +// GetUsagesOk returns a tuple with the Usages field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUsageList) GetUsagesOk() ([]ProjectUsage, bool) { + if o == nil || IsNil(o.Usages) { + return nil, false + } + return o.Usages, true +} + +// HasUsages returns a boolean if a field has been set. +func (o *ProjectUsageList) HasUsages() bool { + if o != nil && !IsNil(o.Usages) { + return true + } + + return false +} + +// SetUsages gets a reference to the given []ProjectUsage and assigns it to the Usages field. +func (o *ProjectUsageList) SetUsages(v []ProjectUsage) { + o.Usages = v +} + +func (o ProjectUsageList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProjectUsageList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Usages) { + toSerialize["usages"] = o.Usages + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProjectUsageList) UnmarshalJSON(data []byte) (err error) { + varProjectUsageList := _ProjectUsageList{} + + err = json.Unmarshal(data, &varProjectUsageList) + + if err != nil { + return err + } + + *o = ProjectUsageList(varProjectUsageList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "usages") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProjectUsageList struct { + value *ProjectUsageList + isSet bool +} + +func (v NullableProjectUsageList) Get() *ProjectUsageList { + return v.value +} + +func (v *NullableProjectUsageList) Set(val *ProjectUsageList) { + v.value = val + v.isSet = true +} + +func (v NullableProjectUsageList) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectUsageList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectUsageList(val *ProjectUsageList) *NullableProjectUsageList { + return &NullableProjectUsageList{value: val, isSet: true} +} + +func (v NullableProjectUsageList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectUsageList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_raid.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_raid.go new file mode 100644 index 00000000..89289a09 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_raid.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Raid type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Raid{} + +// Raid struct for Raid +type Raid struct { + Devices []string `json:"devices,omitempty"` + Level *string `json:"level,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Raid Raid + +// NewRaid instantiates a new Raid object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRaid() *Raid { + this := Raid{} + return &this +} + +// NewRaidWithDefaults instantiates a new Raid object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRaidWithDefaults() *Raid { + this := Raid{} + return &this +} + +// GetDevices returns the Devices field value if set, zero value otherwise. +func (o *Raid) GetDevices() []string { + if o == nil || IsNil(o.Devices) { + var ret []string + return ret + } + return o.Devices +} + +// GetDevicesOk returns a tuple with the Devices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Raid) GetDevicesOk() ([]string, bool) { + if o == nil || IsNil(o.Devices) { + return nil, false + } + return o.Devices, true +} + +// HasDevices returns a boolean if a field has been set. +func (o *Raid) HasDevices() bool { + if o != nil && !IsNil(o.Devices) { + return true + } + + return false +} + +// SetDevices gets a reference to the given []string and assigns it to the Devices field. +func (o *Raid) SetDevices(v []string) { + o.Devices = v +} + +// GetLevel returns the Level field value if set, zero value otherwise. +func (o *Raid) GetLevel() string { + if o == nil || IsNil(o.Level) { + var ret string + return ret + } + return *o.Level +} + +// GetLevelOk returns a tuple with the Level field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Raid) GetLevelOk() (*string, bool) { + if o == nil || IsNil(o.Level) { + return nil, false + } + return o.Level, true +} + +// HasLevel returns a boolean if a field has been set. +func (o *Raid) HasLevel() bool { + if o != nil && !IsNil(o.Level) { + return true + } + + return false +} + +// SetLevel gets a reference to the given string and assigns it to the Level field. +func (o *Raid) SetLevel(v string) { + o.Level = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Raid) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Raid) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Raid) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Raid) SetName(v string) { + o.Name = &v +} + +func (o Raid) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Raid) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Devices) { + toSerialize["devices"] = o.Devices + } + if !IsNil(o.Level) { + toSerialize["level"] = o.Level + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Raid) UnmarshalJSON(data []byte) (err error) { + varRaid := _Raid{} + + err = json.Unmarshal(data, &varRaid) + + if err != nil { + return err + } + + *o = Raid(varRaid) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "devices") + delete(additionalProperties, "level") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRaid struct { + value *Raid + isSet bool +} + +func (v NullableRaid) Get() *Raid { + return v.value +} + +func (v *NullableRaid) Set(val *Raid) { + v.value = val + v.isSet = true +} + +func (v NullableRaid) IsSet() bool { + return v.isSet +} + +func (v *NullableRaid) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRaid(val *Raid) *NullableRaid { + return &NullableRaid{value: val, isSet: true} +} + +func (v NullableRaid) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRaid) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_recovery_code_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_recovery_code_list.go new file mode 100644 index 00000000..71bb8894 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_recovery_code_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the RecoveryCodeList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RecoveryCodeList{} + +// RecoveryCodeList struct for RecoveryCodeList +type RecoveryCodeList struct { + RecoveryCodes []string `json:"recovery_codes,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _RecoveryCodeList RecoveryCodeList + +// NewRecoveryCodeList instantiates a new RecoveryCodeList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRecoveryCodeList() *RecoveryCodeList { + this := RecoveryCodeList{} + return &this +} + +// NewRecoveryCodeListWithDefaults instantiates a new RecoveryCodeList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRecoveryCodeListWithDefaults() *RecoveryCodeList { + this := RecoveryCodeList{} + return &this +} + +// GetRecoveryCodes returns the RecoveryCodes field value if set, zero value otherwise. +func (o *RecoveryCodeList) GetRecoveryCodes() []string { + if o == nil || IsNil(o.RecoveryCodes) { + var ret []string + return ret + } + return o.RecoveryCodes +} + +// GetRecoveryCodesOk returns a tuple with the RecoveryCodes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RecoveryCodeList) GetRecoveryCodesOk() ([]string, bool) { + if o == nil || IsNil(o.RecoveryCodes) { + return nil, false + } + return o.RecoveryCodes, true +} + +// HasRecoveryCodes returns a boolean if a field has been set. +func (o *RecoveryCodeList) HasRecoveryCodes() bool { + if o != nil && !IsNil(o.RecoveryCodes) { + return true + } + + return false +} + +// SetRecoveryCodes gets a reference to the given []string and assigns it to the RecoveryCodes field. +func (o *RecoveryCodeList) SetRecoveryCodes(v []string) { + o.RecoveryCodes = v +} + +func (o RecoveryCodeList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RecoveryCodeList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.RecoveryCodes) { + toSerialize["recovery_codes"] = o.RecoveryCodes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RecoveryCodeList) UnmarshalJSON(data []byte) (err error) { + varRecoveryCodeList := _RecoveryCodeList{} + + err = json.Unmarshal(data, &varRecoveryCodeList) + + if err != nil { + return err + } + + *o = RecoveryCodeList(varRecoveryCodeList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "recovery_codes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRecoveryCodeList struct { + value *RecoveryCodeList + isSet bool +} + +func (v NullableRecoveryCodeList) Get() *RecoveryCodeList { + return v.value +} + +func (v *NullableRecoveryCodeList) Set(val *RecoveryCodeList) { + v.value = val + v.isSet = true +} + +func (v NullableRecoveryCodeList) IsSet() bool { + return v.isSet +} + +func (v *NullableRecoveryCodeList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRecoveryCodeList(val *RecoveryCodeList) *NullableRecoveryCodeList { + return &NullableRecoveryCodeList{value: val, isSet: true} +} + +func (v NullableRecoveryCodeList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRecoveryCodeList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_request_ip_reservation_201_response.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_request_ip_reservation_201_response.go new file mode 100644 index 00000000..b47b2a0b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_request_ip_reservation_201_response.go @@ -0,0 +1,146 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// RequestIPReservation201Response - struct for RequestIPReservation201Response +type RequestIPReservation201Response struct { + IPReservation *IPReservation + VrfIpReservation *VrfIpReservation +} + +// IPReservationAsRequestIPReservation201Response is a convenience function that returns IPReservation wrapped in RequestIPReservation201Response +func IPReservationAsRequestIPReservation201Response(v *IPReservation) RequestIPReservation201Response { + return RequestIPReservation201Response{ + IPReservation: v, + } +} + +// VrfIpReservationAsRequestIPReservation201Response is a convenience function that returns VrfIpReservation wrapped in RequestIPReservation201Response +func VrfIpReservationAsRequestIPReservation201Response(v *VrfIpReservation) RequestIPReservation201Response { + return RequestIPReservation201Response{ + VrfIpReservation: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *RequestIPReservation201Response) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into IPReservation + err = newStrictDecoder(data).Decode(&dst.IPReservation) + if err == nil { + jsonIPReservation, _ := json.Marshal(dst.IPReservation) + if string(jsonIPReservation) == "{}" { // empty struct + dst.IPReservation = nil + } else { + match++ + } + } else { + dst.IPReservation = nil + } + + // try to unmarshal data into VrfIpReservation + err = newStrictDecoder(data).Decode(&dst.VrfIpReservation) + if err == nil { + jsonVrfIpReservation, _ := json.Marshal(dst.VrfIpReservation) + if string(jsonVrfIpReservation) == "{}" { // empty struct + dst.VrfIpReservation = nil + } else { + match++ + } + } else { + dst.VrfIpReservation = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.IPReservation = nil + dst.VrfIpReservation = nil + + return fmt.Errorf("data matches more than one schema in oneOf(RequestIPReservation201Response)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(RequestIPReservation201Response)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src RequestIPReservation201Response) MarshalJSON() ([]byte, error) { + if src.IPReservation != nil { + return json.Marshal(&src.IPReservation) + } + + if src.VrfIpReservation != nil { + return json.Marshal(&src.VrfIpReservation) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *RequestIPReservation201Response) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.IPReservation != nil { + return obj.IPReservation + } + + if obj.VrfIpReservation != nil { + return obj.VrfIpReservation + } + + // all schemas are nil + return nil +} + +type NullableRequestIPReservation201Response struct { + value *RequestIPReservation201Response + isSet bool +} + +func (v NullableRequestIPReservation201Response) Get() *RequestIPReservation201Response { + return v.value +} + +func (v *NullableRequestIPReservation201Response) Set(val *RequestIPReservation201Response) { + v.value = val + v.isSet = true +} + +func (v NullableRequestIPReservation201Response) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestIPReservation201Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestIPReservation201Response(val *RequestIPReservation201Response) *NullableRequestIPReservation201Response { + return &NullableRequestIPReservation201Response{value: val, isSet: true} +} + +func (v NullableRequestIPReservation201Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestIPReservation201Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_request_ip_reservation_request.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_request_ip_reservation_request.go new file mode 100644 index 00000000..4ed842d8 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_request_ip_reservation_request.go @@ -0,0 +1,146 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// RequestIPReservationRequest - struct for RequestIPReservationRequest +type RequestIPReservationRequest struct { + IPReservationRequestInput *IPReservationRequestInput + VrfIpReservationCreateInput *VrfIpReservationCreateInput +} + +// IPReservationRequestInputAsRequestIPReservationRequest is a convenience function that returns IPReservationRequestInput wrapped in RequestIPReservationRequest +func IPReservationRequestInputAsRequestIPReservationRequest(v *IPReservationRequestInput) RequestIPReservationRequest { + return RequestIPReservationRequest{ + IPReservationRequestInput: v, + } +} + +// VrfIpReservationCreateInputAsRequestIPReservationRequest is a convenience function that returns VrfIpReservationCreateInput wrapped in RequestIPReservationRequest +func VrfIpReservationCreateInputAsRequestIPReservationRequest(v *VrfIpReservationCreateInput) RequestIPReservationRequest { + return RequestIPReservationRequest{ + VrfIpReservationCreateInput: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *RequestIPReservationRequest) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into IPReservationRequestInput + err = newStrictDecoder(data).Decode(&dst.IPReservationRequestInput) + if err == nil { + jsonIPReservationRequestInput, _ := json.Marshal(dst.IPReservationRequestInput) + if string(jsonIPReservationRequestInput) == "{}" { // empty struct + dst.IPReservationRequestInput = nil + } else { + match++ + } + } else { + dst.IPReservationRequestInput = nil + } + + // try to unmarshal data into VrfIpReservationCreateInput + err = newStrictDecoder(data).Decode(&dst.VrfIpReservationCreateInput) + if err == nil { + jsonVrfIpReservationCreateInput, _ := json.Marshal(dst.VrfIpReservationCreateInput) + if string(jsonVrfIpReservationCreateInput) == "{}" { // empty struct + dst.VrfIpReservationCreateInput = nil + } else { + match++ + } + } else { + dst.VrfIpReservationCreateInput = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.IPReservationRequestInput = nil + dst.VrfIpReservationCreateInput = nil + + return fmt.Errorf("data matches more than one schema in oneOf(RequestIPReservationRequest)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(RequestIPReservationRequest)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src RequestIPReservationRequest) MarshalJSON() ([]byte, error) { + if src.IPReservationRequestInput != nil { + return json.Marshal(&src.IPReservationRequestInput) + } + + if src.VrfIpReservationCreateInput != nil { + return json.Marshal(&src.VrfIpReservationCreateInput) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *RequestIPReservationRequest) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.IPReservationRequestInput != nil { + return obj.IPReservationRequestInput + } + + if obj.VrfIpReservationCreateInput != nil { + return obj.VrfIpReservationCreateInput + } + + // all schemas are nil + return nil +} + +type NullableRequestIPReservationRequest struct { + value *RequestIPReservationRequest + isSet bool +} + +func (v NullableRequestIPReservationRequest) Get() *RequestIPReservationRequest { + return v.value +} + +func (v *NullableRequestIPReservationRequest) Set(val *RequestIPReservationRequest) { + v.value = val + v.isSet = true +} + +func (v NullableRequestIPReservationRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestIPReservationRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestIPReservationRequest(val *RequestIPReservationRequest) *NullableRequestIPReservationRequest { + return &NullableRequestIPReservationRequest{value: val, isSet: true} +} + +func (v NullableRequestIPReservationRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestIPReservationRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_item_request.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_item_request.go new file mode 100644 index 00000000..68d5553a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_item_request.go @@ -0,0 +1,302 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SelfServiceReservationItemRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SelfServiceReservationItemRequest{} + +// SelfServiceReservationItemRequest struct for SelfServiceReservationItemRequest +type SelfServiceReservationItemRequest struct { + Amount *float32 `json:"amount,omitempty"` + MetroId *string `json:"metro_id,omitempty"` + PlanId *string `json:"plan_id,omitempty"` + Quantity *int32 `json:"quantity,omitempty"` + Term *string `json:"term,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SelfServiceReservationItemRequest SelfServiceReservationItemRequest + +// NewSelfServiceReservationItemRequest instantiates a new SelfServiceReservationItemRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSelfServiceReservationItemRequest() *SelfServiceReservationItemRequest { + this := SelfServiceReservationItemRequest{} + return &this +} + +// NewSelfServiceReservationItemRequestWithDefaults instantiates a new SelfServiceReservationItemRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSelfServiceReservationItemRequestWithDefaults() *SelfServiceReservationItemRequest { + this := SelfServiceReservationItemRequest{} + return &this +} + +// GetAmount returns the Amount field value if set, zero value otherwise. +func (o *SelfServiceReservationItemRequest) GetAmount() float32 { + if o == nil || IsNil(o.Amount) { + var ret float32 + return ret + } + return *o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemRequest) GetAmountOk() (*float32, bool) { + if o == nil || IsNil(o.Amount) { + return nil, false + } + return o.Amount, true +} + +// HasAmount returns a boolean if a field has been set. +func (o *SelfServiceReservationItemRequest) HasAmount() bool { + if o != nil && !IsNil(o.Amount) { + return true + } + + return false +} + +// SetAmount gets a reference to the given float32 and assigns it to the Amount field. +func (o *SelfServiceReservationItemRequest) SetAmount(v float32) { + o.Amount = &v +} + +// GetMetroId returns the MetroId field value if set, zero value otherwise. +func (o *SelfServiceReservationItemRequest) GetMetroId() string { + if o == nil || IsNil(o.MetroId) { + var ret string + return ret + } + return *o.MetroId +} + +// GetMetroIdOk returns a tuple with the MetroId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemRequest) GetMetroIdOk() (*string, bool) { + if o == nil || IsNil(o.MetroId) { + return nil, false + } + return o.MetroId, true +} + +// HasMetroId returns a boolean if a field has been set. +func (o *SelfServiceReservationItemRequest) HasMetroId() bool { + if o != nil && !IsNil(o.MetroId) { + return true + } + + return false +} + +// SetMetroId gets a reference to the given string and assigns it to the MetroId field. +func (o *SelfServiceReservationItemRequest) SetMetroId(v string) { + o.MetroId = &v +} + +// GetPlanId returns the PlanId field value if set, zero value otherwise. +func (o *SelfServiceReservationItemRequest) GetPlanId() string { + if o == nil || IsNil(o.PlanId) { + var ret string + return ret + } + return *o.PlanId +} + +// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemRequest) GetPlanIdOk() (*string, bool) { + if o == nil || IsNil(o.PlanId) { + return nil, false + } + return o.PlanId, true +} + +// HasPlanId returns a boolean if a field has been set. +func (o *SelfServiceReservationItemRequest) HasPlanId() bool { + if o != nil && !IsNil(o.PlanId) { + return true + } + + return false +} + +// SetPlanId gets a reference to the given string and assigns it to the PlanId field. +func (o *SelfServiceReservationItemRequest) SetPlanId(v string) { + o.PlanId = &v +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *SelfServiceReservationItemRequest) GetQuantity() int32 { + if o == nil || IsNil(o.Quantity) { + var ret int32 + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemRequest) GetQuantityOk() (*int32, bool) { + if o == nil || IsNil(o.Quantity) { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *SelfServiceReservationItemRequest) HasQuantity() bool { + if o != nil && !IsNil(o.Quantity) { + return true + } + + return false +} + +// SetQuantity gets a reference to the given int32 and assigns it to the Quantity field. +func (o *SelfServiceReservationItemRequest) SetQuantity(v int32) { + o.Quantity = &v +} + +// GetTerm returns the Term field value if set, zero value otherwise. +func (o *SelfServiceReservationItemRequest) GetTerm() string { + if o == nil || IsNil(o.Term) { + var ret string + return ret + } + return *o.Term +} + +// GetTermOk returns a tuple with the Term field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemRequest) GetTermOk() (*string, bool) { + if o == nil || IsNil(o.Term) { + return nil, false + } + return o.Term, true +} + +// HasTerm returns a boolean if a field has been set. +func (o *SelfServiceReservationItemRequest) HasTerm() bool { + if o != nil && !IsNil(o.Term) { + return true + } + + return false +} + +// SetTerm gets a reference to the given string and assigns it to the Term field. +func (o *SelfServiceReservationItemRequest) SetTerm(v string) { + o.Term = &v +} + +func (o SelfServiceReservationItemRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SelfServiceReservationItemRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Amount) { + toSerialize["amount"] = o.Amount + } + if !IsNil(o.MetroId) { + toSerialize["metro_id"] = o.MetroId + } + if !IsNil(o.PlanId) { + toSerialize["plan_id"] = o.PlanId + } + if !IsNil(o.Quantity) { + toSerialize["quantity"] = o.Quantity + } + if !IsNil(o.Term) { + toSerialize["term"] = o.Term + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SelfServiceReservationItemRequest) UnmarshalJSON(data []byte) (err error) { + varSelfServiceReservationItemRequest := _SelfServiceReservationItemRequest{} + + err = json.Unmarshal(data, &varSelfServiceReservationItemRequest) + + if err != nil { + return err + } + + *o = SelfServiceReservationItemRequest(varSelfServiceReservationItemRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "amount") + delete(additionalProperties, "metro_id") + delete(additionalProperties, "plan_id") + delete(additionalProperties, "quantity") + delete(additionalProperties, "term") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSelfServiceReservationItemRequest struct { + value *SelfServiceReservationItemRequest + isSet bool +} + +func (v NullableSelfServiceReservationItemRequest) Get() *SelfServiceReservationItemRequest { + return v.value +} + +func (v *NullableSelfServiceReservationItemRequest) Set(val *SelfServiceReservationItemRequest) { + v.value = val + v.isSet = true +} + +func (v NullableSelfServiceReservationItemRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableSelfServiceReservationItemRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSelfServiceReservationItemRequest(val *SelfServiceReservationItemRequest) *NullableSelfServiceReservationItemRequest { + return &NullableSelfServiceReservationItemRequest{value: val, isSet: true} +} + +func (v NullableSelfServiceReservationItemRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSelfServiceReservationItemRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_item_response.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_item_response.go new file mode 100644 index 00000000..ec05cfc4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_item_response.go @@ -0,0 +1,524 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SelfServiceReservationItemResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SelfServiceReservationItemResponse{} + +// SelfServiceReservationItemResponse struct for SelfServiceReservationItemResponse +type SelfServiceReservationItemResponse struct { + Amount *float32 `json:"amount,omitempty"` + Id *string `json:"id,omitempty"` + MetroCode *string `json:"metro_code,omitempty"` + MetroId *string `json:"metro_id,omitempty"` + MetroName *string `json:"metro_name,omitempty"` + PlanId *string `json:"plan_id,omitempty"` + PlanName *string `json:"plan_name,omitempty"` + PlanSlug *string `json:"plan_slug,omitempty"` + PlanCategories []string `json:"plan_categories,omitempty"` + Quantity *int32 `json:"quantity,omitempty"` + Term *string `json:"term,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SelfServiceReservationItemResponse SelfServiceReservationItemResponse + +// NewSelfServiceReservationItemResponse instantiates a new SelfServiceReservationItemResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSelfServiceReservationItemResponse() *SelfServiceReservationItemResponse { + this := SelfServiceReservationItemResponse{} + return &this +} + +// NewSelfServiceReservationItemResponseWithDefaults instantiates a new SelfServiceReservationItemResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSelfServiceReservationItemResponseWithDefaults() *SelfServiceReservationItemResponse { + this := SelfServiceReservationItemResponse{} + return &this +} + +// GetAmount returns the Amount field value if set, zero value otherwise. +func (o *SelfServiceReservationItemResponse) GetAmount() float32 { + if o == nil || IsNil(o.Amount) { + var ret float32 + return ret + } + return *o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemResponse) GetAmountOk() (*float32, bool) { + if o == nil || IsNil(o.Amount) { + return nil, false + } + return o.Amount, true +} + +// HasAmount returns a boolean if a field has been set. +func (o *SelfServiceReservationItemResponse) HasAmount() bool { + if o != nil && !IsNil(o.Amount) { + return true + } + + return false +} + +// SetAmount gets a reference to the given float32 and assigns it to the Amount field. +func (o *SelfServiceReservationItemResponse) SetAmount(v float32) { + o.Amount = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SelfServiceReservationItemResponse) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemResponse) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SelfServiceReservationItemResponse) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SelfServiceReservationItemResponse) SetId(v string) { + o.Id = &v +} + +// GetMetroCode returns the MetroCode field value if set, zero value otherwise. +func (o *SelfServiceReservationItemResponse) GetMetroCode() string { + if o == nil || IsNil(o.MetroCode) { + var ret string + return ret + } + return *o.MetroCode +} + +// GetMetroCodeOk returns a tuple with the MetroCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemResponse) GetMetroCodeOk() (*string, bool) { + if o == nil || IsNil(o.MetroCode) { + return nil, false + } + return o.MetroCode, true +} + +// HasMetroCode returns a boolean if a field has been set. +func (o *SelfServiceReservationItemResponse) HasMetroCode() bool { + if o != nil && !IsNil(o.MetroCode) { + return true + } + + return false +} + +// SetMetroCode gets a reference to the given string and assigns it to the MetroCode field. +func (o *SelfServiceReservationItemResponse) SetMetroCode(v string) { + o.MetroCode = &v +} + +// GetMetroId returns the MetroId field value if set, zero value otherwise. +func (o *SelfServiceReservationItemResponse) GetMetroId() string { + if o == nil || IsNil(o.MetroId) { + var ret string + return ret + } + return *o.MetroId +} + +// GetMetroIdOk returns a tuple with the MetroId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemResponse) GetMetroIdOk() (*string, bool) { + if o == nil || IsNil(o.MetroId) { + return nil, false + } + return o.MetroId, true +} + +// HasMetroId returns a boolean if a field has been set. +func (o *SelfServiceReservationItemResponse) HasMetroId() bool { + if o != nil && !IsNil(o.MetroId) { + return true + } + + return false +} + +// SetMetroId gets a reference to the given string and assigns it to the MetroId field. +func (o *SelfServiceReservationItemResponse) SetMetroId(v string) { + o.MetroId = &v +} + +// GetMetroName returns the MetroName field value if set, zero value otherwise. +func (o *SelfServiceReservationItemResponse) GetMetroName() string { + if o == nil || IsNil(o.MetroName) { + var ret string + return ret + } + return *o.MetroName +} + +// GetMetroNameOk returns a tuple with the MetroName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemResponse) GetMetroNameOk() (*string, bool) { + if o == nil || IsNil(o.MetroName) { + return nil, false + } + return o.MetroName, true +} + +// HasMetroName returns a boolean if a field has been set. +func (o *SelfServiceReservationItemResponse) HasMetroName() bool { + if o != nil && !IsNil(o.MetroName) { + return true + } + + return false +} + +// SetMetroName gets a reference to the given string and assigns it to the MetroName field. +func (o *SelfServiceReservationItemResponse) SetMetroName(v string) { + o.MetroName = &v +} + +// GetPlanId returns the PlanId field value if set, zero value otherwise. +func (o *SelfServiceReservationItemResponse) GetPlanId() string { + if o == nil || IsNil(o.PlanId) { + var ret string + return ret + } + return *o.PlanId +} + +// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemResponse) GetPlanIdOk() (*string, bool) { + if o == nil || IsNil(o.PlanId) { + return nil, false + } + return o.PlanId, true +} + +// HasPlanId returns a boolean if a field has been set. +func (o *SelfServiceReservationItemResponse) HasPlanId() bool { + if o != nil && !IsNil(o.PlanId) { + return true + } + + return false +} + +// SetPlanId gets a reference to the given string and assigns it to the PlanId field. +func (o *SelfServiceReservationItemResponse) SetPlanId(v string) { + o.PlanId = &v +} + +// GetPlanName returns the PlanName field value if set, zero value otherwise. +func (o *SelfServiceReservationItemResponse) GetPlanName() string { + if o == nil || IsNil(o.PlanName) { + var ret string + return ret + } + return *o.PlanName +} + +// GetPlanNameOk returns a tuple with the PlanName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemResponse) GetPlanNameOk() (*string, bool) { + if o == nil || IsNil(o.PlanName) { + return nil, false + } + return o.PlanName, true +} + +// HasPlanName returns a boolean if a field has been set. +func (o *SelfServiceReservationItemResponse) HasPlanName() bool { + if o != nil && !IsNil(o.PlanName) { + return true + } + + return false +} + +// SetPlanName gets a reference to the given string and assigns it to the PlanName field. +func (o *SelfServiceReservationItemResponse) SetPlanName(v string) { + o.PlanName = &v +} + +// GetPlanSlug returns the PlanSlug field value if set, zero value otherwise. +func (o *SelfServiceReservationItemResponse) GetPlanSlug() string { + if o == nil || IsNil(o.PlanSlug) { + var ret string + return ret + } + return *o.PlanSlug +} + +// GetPlanSlugOk returns a tuple with the PlanSlug field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemResponse) GetPlanSlugOk() (*string, bool) { + if o == nil || IsNil(o.PlanSlug) { + return nil, false + } + return o.PlanSlug, true +} + +// HasPlanSlug returns a boolean if a field has been set. +func (o *SelfServiceReservationItemResponse) HasPlanSlug() bool { + if o != nil && !IsNil(o.PlanSlug) { + return true + } + + return false +} + +// SetPlanSlug gets a reference to the given string and assigns it to the PlanSlug field. +func (o *SelfServiceReservationItemResponse) SetPlanSlug(v string) { + o.PlanSlug = &v +} + +// GetPlanCategories returns the PlanCategories field value if set, zero value otherwise. +func (o *SelfServiceReservationItemResponse) GetPlanCategories() []string { + if o == nil || IsNil(o.PlanCategories) { + var ret []string + return ret + } + return o.PlanCategories +} + +// GetPlanCategoriesOk returns a tuple with the PlanCategories field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemResponse) GetPlanCategoriesOk() ([]string, bool) { + if o == nil || IsNil(o.PlanCategories) { + return nil, false + } + return o.PlanCategories, true +} + +// HasPlanCategories returns a boolean if a field has been set. +func (o *SelfServiceReservationItemResponse) HasPlanCategories() bool { + if o != nil && !IsNil(o.PlanCategories) { + return true + } + + return false +} + +// SetPlanCategories gets a reference to the given []string and assigns it to the PlanCategories field. +func (o *SelfServiceReservationItemResponse) SetPlanCategories(v []string) { + o.PlanCategories = v +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *SelfServiceReservationItemResponse) GetQuantity() int32 { + if o == nil || IsNil(o.Quantity) { + var ret int32 + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemResponse) GetQuantityOk() (*int32, bool) { + if o == nil || IsNil(o.Quantity) { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *SelfServiceReservationItemResponse) HasQuantity() bool { + if o != nil && !IsNil(o.Quantity) { + return true + } + + return false +} + +// SetQuantity gets a reference to the given int32 and assigns it to the Quantity field. +func (o *SelfServiceReservationItemResponse) SetQuantity(v int32) { + o.Quantity = &v +} + +// GetTerm returns the Term field value if set, zero value otherwise. +func (o *SelfServiceReservationItemResponse) GetTerm() string { + if o == nil || IsNil(o.Term) { + var ret string + return ret + } + return *o.Term +} + +// GetTermOk returns a tuple with the Term field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationItemResponse) GetTermOk() (*string, bool) { + if o == nil || IsNil(o.Term) { + return nil, false + } + return o.Term, true +} + +// HasTerm returns a boolean if a field has been set. +func (o *SelfServiceReservationItemResponse) HasTerm() bool { + if o != nil && !IsNil(o.Term) { + return true + } + + return false +} + +// SetTerm gets a reference to the given string and assigns it to the Term field. +func (o *SelfServiceReservationItemResponse) SetTerm(v string) { + o.Term = &v +} + +func (o SelfServiceReservationItemResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SelfServiceReservationItemResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Amount) { + toSerialize["amount"] = o.Amount + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.MetroCode) { + toSerialize["metro_code"] = o.MetroCode + } + if !IsNil(o.MetroId) { + toSerialize["metro_id"] = o.MetroId + } + if !IsNil(o.MetroName) { + toSerialize["metro_name"] = o.MetroName + } + if !IsNil(o.PlanId) { + toSerialize["plan_id"] = o.PlanId + } + if !IsNil(o.PlanName) { + toSerialize["plan_name"] = o.PlanName + } + if !IsNil(o.PlanSlug) { + toSerialize["plan_slug"] = o.PlanSlug + } + if !IsNil(o.PlanCategories) { + toSerialize["plan_categories"] = o.PlanCategories + } + if !IsNil(o.Quantity) { + toSerialize["quantity"] = o.Quantity + } + if !IsNil(o.Term) { + toSerialize["term"] = o.Term + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SelfServiceReservationItemResponse) UnmarshalJSON(data []byte) (err error) { + varSelfServiceReservationItemResponse := _SelfServiceReservationItemResponse{} + + err = json.Unmarshal(data, &varSelfServiceReservationItemResponse) + + if err != nil { + return err + } + + *o = SelfServiceReservationItemResponse(varSelfServiceReservationItemResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "amount") + delete(additionalProperties, "id") + delete(additionalProperties, "metro_code") + delete(additionalProperties, "metro_id") + delete(additionalProperties, "metro_name") + delete(additionalProperties, "plan_id") + delete(additionalProperties, "plan_name") + delete(additionalProperties, "plan_slug") + delete(additionalProperties, "plan_categories") + delete(additionalProperties, "quantity") + delete(additionalProperties, "term") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSelfServiceReservationItemResponse struct { + value *SelfServiceReservationItemResponse + isSet bool +} + +func (v NullableSelfServiceReservationItemResponse) Get() *SelfServiceReservationItemResponse { + return v.value +} + +func (v *NullableSelfServiceReservationItemResponse) Set(val *SelfServiceReservationItemResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSelfServiceReservationItemResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSelfServiceReservationItemResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSelfServiceReservationItemResponse(val *SelfServiceReservationItemResponse) *NullableSelfServiceReservationItemResponse { + return &NullableSelfServiceReservationItemResponse{value: val, isSet: true} +} + +func (v NullableSelfServiceReservationItemResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSelfServiceReservationItemResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_list.go new file mode 100644 index 00000000..2adc89bc --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SelfServiceReservationList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SelfServiceReservationList{} + +// SelfServiceReservationList struct for SelfServiceReservationList +type SelfServiceReservationList struct { + Reservations []SelfServiceReservationResponse `json:"reservations,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SelfServiceReservationList SelfServiceReservationList + +// NewSelfServiceReservationList instantiates a new SelfServiceReservationList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSelfServiceReservationList() *SelfServiceReservationList { + this := SelfServiceReservationList{} + return &this +} + +// NewSelfServiceReservationListWithDefaults instantiates a new SelfServiceReservationList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSelfServiceReservationListWithDefaults() *SelfServiceReservationList { + this := SelfServiceReservationList{} + return &this +} + +// GetReservations returns the Reservations field value if set, zero value otherwise. +func (o *SelfServiceReservationList) GetReservations() []SelfServiceReservationResponse { + if o == nil || IsNil(o.Reservations) { + var ret []SelfServiceReservationResponse + return ret + } + return o.Reservations +} + +// GetReservationsOk returns a tuple with the Reservations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationList) GetReservationsOk() ([]SelfServiceReservationResponse, bool) { + if o == nil || IsNil(o.Reservations) { + return nil, false + } + return o.Reservations, true +} + +// HasReservations returns a boolean if a field has been set. +func (o *SelfServiceReservationList) HasReservations() bool { + if o != nil && !IsNil(o.Reservations) { + return true + } + + return false +} + +// SetReservations gets a reference to the given []SelfServiceReservationResponse and assigns it to the Reservations field. +func (o *SelfServiceReservationList) SetReservations(v []SelfServiceReservationResponse) { + o.Reservations = v +} + +func (o SelfServiceReservationList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SelfServiceReservationList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Reservations) { + toSerialize["reservations"] = o.Reservations + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SelfServiceReservationList) UnmarshalJSON(data []byte) (err error) { + varSelfServiceReservationList := _SelfServiceReservationList{} + + err = json.Unmarshal(data, &varSelfServiceReservationList) + + if err != nil { + return err + } + + *o = SelfServiceReservationList(varSelfServiceReservationList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "reservations") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSelfServiceReservationList struct { + value *SelfServiceReservationList + isSet bool +} + +func (v NullableSelfServiceReservationList) Get() *SelfServiceReservationList { + return v.value +} + +func (v *NullableSelfServiceReservationList) Set(val *SelfServiceReservationList) { + v.value = val + v.isSet = true +} + +func (v NullableSelfServiceReservationList) IsSet() bool { + return v.isSet +} + +func (v *NullableSelfServiceReservationList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSelfServiceReservationList(val *SelfServiceReservationList) *NullableSelfServiceReservationList { + return &NullableSelfServiceReservationList{value: val, isSet: true} +} + +func (v NullableSelfServiceReservationList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSelfServiceReservationList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_response.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_response.go new file mode 100644 index 00000000..3bfece91 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_self_service_reservation_response.go @@ -0,0 +1,525 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the SelfServiceReservationResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SelfServiceReservationResponse{} + +// SelfServiceReservationResponse struct for SelfServiceReservationResponse +type SelfServiceReservationResponse struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + Item []SelfServiceReservationItemResponse `json:"item,omitempty"` + Notes *string `json:"notes,omitempty"` + Organization *string `json:"organization,omitempty"` + OrganizationId *string `json:"organization_id,omitempty"` + Period *CreateSelfServiceReservationRequestPeriod `json:"period,omitempty"` + Project *string `json:"project,omitempty"` + ProjectId *string `json:"project_id,omitempty"` + StartDate *time.Time `json:"start_date,omitempty"` + Status *string `json:"status,omitempty"` + TotalCost *int32 `json:"total_cost,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SelfServiceReservationResponse SelfServiceReservationResponse + +// NewSelfServiceReservationResponse instantiates a new SelfServiceReservationResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSelfServiceReservationResponse() *SelfServiceReservationResponse { + this := SelfServiceReservationResponse{} + return &this +} + +// NewSelfServiceReservationResponseWithDefaults instantiates a new SelfServiceReservationResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSelfServiceReservationResponseWithDefaults() *SelfServiceReservationResponse { + this := SelfServiceReservationResponse{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SelfServiceReservationResponse) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationResponse) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *SelfServiceReservationResponse) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *SelfServiceReservationResponse) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetItem returns the Item field value if set, zero value otherwise. +func (o *SelfServiceReservationResponse) GetItem() []SelfServiceReservationItemResponse { + if o == nil || IsNil(o.Item) { + var ret []SelfServiceReservationItemResponse + return ret + } + return o.Item +} + +// GetItemOk returns a tuple with the Item field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationResponse) GetItemOk() ([]SelfServiceReservationItemResponse, bool) { + if o == nil || IsNil(o.Item) { + return nil, false + } + return o.Item, true +} + +// HasItem returns a boolean if a field has been set. +func (o *SelfServiceReservationResponse) HasItem() bool { + if o != nil && !IsNil(o.Item) { + return true + } + + return false +} + +// SetItem gets a reference to the given []SelfServiceReservationItemResponse and assigns it to the Item field. +func (o *SelfServiceReservationResponse) SetItem(v []SelfServiceReservationItemResponse) { + o.Item = v +} + +// GetNotes returns the Notes field value if set, zero value otherwise. +func (o *SelfServiceReservationResponse) GetNotes() string { + if o == nil || IsNil(o.Notes) { + var ret string + return ret + } + return *o.Notes +} + +// GetNotesOk returns a tuple with the Notes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationResponse) GetNotesOk() (*string, bool) { + if o == nil || IsNil(o.Notes) { + return nil, false + } + return o.Notes, true +} + +// HasNotes returns a boolean if a field has been set. +func (o *SelfServiceReservationResponse) HasNotes() bool { + if o != nil && !IsNil(o.Notes) { + return true + } + + return false +} + +// SetNotes gets a reference to the given string and assigns it to the Notes field. +func (o *SelfServiceReservationResponse) SetNotes(v string) { + o.Notes = &v +} + +// GetOrganization returns the Organization field value if set, zero value otherwise. +func (o *SelfServiceReservationResponse) GetOrganization() string { + if o == nil || IsNil(o.Organization) { + var ret string + return ret + } + return *o.Organization +} + +// GetOrganizationOk returns a tuple with the Organization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationResponse) GetOrganizationOk() (*string, bool) { + if o == nil || IsNil(o.Organization) { + return nil, false + } + return o.Organization, true +} + +// HasOrganization returns a boolean if a field has been set. +func (o *SelfServiceReservationResponse) HasOrganization() bool { + if o != nil && !IsNil(o.Organization) { + return true + } + + return false +} + +// SetOrganization gets a reference to the given string and assigns it to the Organization field. +func (o *SelfServiceReservationResponse) SetOrganization(v string) { + o.Organization = &v +} + +// GetOrganizationId returns the OrganizationId field value if set, zero value otherwise. +func (o *SelfServiceReservationResponse) GetOrganizationId() string { + if o == nil || IsNil(o.OrganizationId) { + var ret string + return ret + } + return *o.OrganizationId +} + +// GetOrganizationIdOk returns a tuple with the OrganizationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationResponse) GetOrganizationIdOk() (*string, bool) { + if o == nil || IsNil(o.OrganizationId) { + return nil, false + } + return o.OrganizationId, true +} + +// HasOrganizationId returns a boolean if a field has been set. +func (o *SelfServiceReservationResponse) HasOrganizationId() bool { + if o != nil && !IsNil(o.OrganizationId) { + return true + } + + return false +} + +// SetOrganizationId gets a reference to the given string and assigns it to the OrganizationId field. +func (o *SelfServiceReservationResponse) SetOrganizationId(v string) { + o.OrganizationId = &v +} + +// GetPeriod returns the Period field value if set, zero value otherwise. +func (o *SelfServiceReservationResponse) GetPeriod() CreateSelfServiceReservationRequestPeriod { + if o == nil || IsNil(o.Period) { + var ret CreateSelfServiceReservationRequestPeriod + return ret + } + return *o.Period +} + +// GetPeriodOk returns a tuple with the Period field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationResponse) GetPeriodOk() (*CreateSelfServiceReservationRequestPeriod, bool) { + if o == nil || IsNil(o.Period) { + return nil, false + } + return o.Period, true +} + +// HasPeriod returns a boolean if a field has been set. +func (o *SelfServiceReservationResponse) HasPeriod() bool { + if o != nil && !IsNil(o.Period) { + return true + } + + return false +} + +// SetPeriod gets a reference to the given CreateSelfServiceReservationRequestPeriod and assigns it to the Period field. +func (o *SelfServiceReservationResponse) SetPeriod(v CreateSelfServiceReservationRequestPeriod) { + o.Period = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *SelfServiceReservationResponse) GetProject() string { + if o == nil || IsNil(o.Project) { + var ret string + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationResponse) GetProjectOk() (*string, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *SelfServiceReservationResponse) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given string and assigns it to the Project field. +func (o *SelfServiceReservationResponse) SetProject(v string) { + o.Project = &v +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *SelfServiceReservationResponse) GetProjectId() string { + if o == nil || IsNil(o.ProjectId) { + var ret string + return ret + } + return *o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationResponse) GetProjectIdOk() (*string, bool) { + if o == nil || IsNil(o.ProjectId) { + return nil, false + } + return o.ProjectId, true +} + +// HasProjectId returns a boolean if a field has been set. +func (o *SelfServiceReservationResponse) HasProjectId() bool { + if o != nil && !IsNil(o.ProjectId) { + return true + } + + return false +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *SelfServiceReservationResponse) SetProjectId(v string) { + o.ProjectId = &v +} + +// GetStartDate returns the StartDate field value if set, zero value otherwise. +func (o *SelfServiceReservationResponse) GetStartDate() time.Time { + if o == nil || IsNil(o.StartDate) { + var ret time.Time + return ret + } + return *o.StartDate +} + +// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationResponse) GetStartDateOk() (*time.Time, bool) { + if o == nil || IsNil(o.StartDate) { + return nil, false + } + return o.StartDate, true +} + +// HasStartDate returns a boolean if a field has been set. +func (o *SelfServiceReservationResponse) HasStartDate() bool { + if o != nil && !IsNil(o.StartDate) { + return true + } + + return false +} + +// SetStartDate gets a reference to the given time.Time and assigns it to the StartDate field. +func (o *SelfServiceReservationResponse) SetStartDate(v time.Time) { + o.StartDate = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SelfServiceReservationResponse) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationResponse) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SelfServiceReservationResponse) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *SelfServiceReservationResponse) SetStatus(v string) { + o.Status = &v +} + +// GetTotalCost returns the TotalCost field value if set, zero value otherwise. +func (o *SelfServiceReservationResponse) GetTotalCost() int32 { + if o == nil || IsNil(o.TotalCost) { + var ret int32 + return ret + } + return *o.TotalCost +} + +// GetTotalCostOk returns a tuple with the TotalCost field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SelfServiceReservationResponse) GetTotalCostOk() (*int32, bool) { + if o == nil || IsNil(o.TotalCost) { + return nil, false + } + return o.TotalCost, true +} + +// HasTotalCost returns a boolean if a field has been set. +func (o *SelfServiceReservationResponse) HasTotalCost() bool { + if o != nil && !IsNil(o.TotalCost) { + return true + } + + return false +} + +// SetTotalCost gets a reference to the given int32 and assigns it to the TotalCost field. +func (o *SelfServiceReservationResponse) SetTotalCost(v int32) { + o.TotalCost = &v +} + +func (o SelfServiceReservationResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SelfServiceReservationResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Item) { + toSerialize["item"] = o.Item + } + if !IsNil(o.Notes) { + toSerialize["notes"] = o.Notes + } + if !IsNil(o.Organization) { + toSerialize["organization"] = o.Organization + } + if !IsNil(o.OrganizationId) { + toSerialize["organization_id"] = o.OrganizationId + } + if !IsNil(o.Period) { + toSerialize["period"] = o.Period + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.ProjectId) { + toSerialize["project_id"] = o.ProjectId + } + if !IsNil(o.StartDate) { + toSerialize["start_date"] = o.StartDate + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.TotalCost) { + toSerialize["total_cost"] = o.TotalCost + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SelfServiceReservationResponse) UnmarshalJSON(data []byte) (err error) { + varSelfServiceReservationResponse := _SelfServiceReservationResponse{} + + err = json.Unmarshal(data, &varSelfServiceReservationResponse) + + if err != nil { + return err + } + + *o = SelfServiceReservationResponse(varSelfServiceReservationResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "item") + delete(additionalProperties, "notes") + delete(additionalProperties, "organization") + delete(additionalProperties, "organization_id") + delete(additionalProperties, "period") + delete(additionalProperties, "project") + delete(additionalProperties, "project_id") + delete(additionalProperties, "start_date") + delete(additionalProperties, "status") + delete(additionalProperties, "total_cost") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSelfServiceReservationResponse struct { + value *SelfServiceReservationResponse + isSet bool +} + +func (v NullableSelfServiceReservationResponse) Get() *SelfServiceReservationResponse { + return v.value +} + +func (v *NullableSelfServiceReservationResponse) Set(val *SelfServiceReservationResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSelfServiceReservationResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSelfServiceReservationResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSelfServiceReservationResponse(val *SelfServiceReservationResponse) *NullableSelfServiceReservationResponse { + return &NullableSelfServiceReservationResponse{value: val, isSet: true} +} + +func (v NullableSelfServiceReservationResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSelfServiceReservationResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_server_info.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_server_info.go new file mode 100644 index 00000000..8c0ce717 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_server_info.go @@ -0,0 +1,272 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the ServerInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerInfo{} + +// ServerInfo struct for ServerInfo +type ServerInfo struct { + // Deprecated + Facility *string `json:"facility,omitempty"` + // The metro ID or code to check the capacity in. + Metro *string `json:"metro,omitempty"` + // The plan ID or slug to check the capacity of. + Plan *string `json:"plan,omitempty"` + // The number of servers to check the capacity of. + Quantity *string `json:"quantity,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ServerInfo ServerInfo + +// NewServerInfo instantiates a new ServerInfo object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServerInfo() *ServerInfo { + this := ServerInfo{} + return &this +} + +// NewServerInfoWithDefaults instantiates a new ServerInfo object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServerInfoWithDefaults() *ServerInfo { + this := ServerInfo{} + return &this +} + +// GetFacility returns the Facility field value if set, zero value otherwise. +// Deprecated +func (o *ServerInfo) GetFacility() string { + if o == nil || IsNil(o.Facility) { + var ret string + return ret + } + return *o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *ServerInfo) GetFacilityOk() (*string, bool) { + if o == nil || IsNil(o.Facility) { + return nil, false + } + return o.Facility, true +} + +// HasFacility returns a boolean if a field has been set. +func (o *ServerInfo) HasFacility() bool { + if o != nil && !IsNil(o.Facility) { + return true + } + + return false +} + +// SetFacility gets a reference to the given string and assigns it to the Facility field. +// Deprecated +func (o *ServerInfo) SetFacility(v string) { + o.Facility = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *ServerInfo) GetMetro() string { + if o == nil || IsNil(o.Metro) { + var ret string + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerInfo) GetMetroOk() (*string, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *ServerInfo) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given string and assigns it to the Metro field. +func (o *ServerInfo) SetMetro(v string) { + o.Metro = &v +} + +// GetPlan returns the Plan field value if set, zero value otherwise. +func (o *ServerInfo) GetPlan() string { + if o == nil || IsNil(o.Plan) { + var ret string + return ret + } + return *o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerInfo) GetPlanOk() (*string, bool) { + if o == nil || IsNil(o.Plan) { + return nil, false + } + return o.Plan, true +} + +// HasPlan returns a boolean if a field has been set. +func (o *ServerInfo) HasPlan() bool { + if o != nil && !IsNil(o.Plan) { + return true + } + + return false +} + +// SetPlan gets a reference to the given string and assigns it to the Plan field. +func (o *ServerInfo) SetPlan(v string) { + o.Plan = &v +} + +// GetQuantity returns the Quantity field value if set, zero value otherwise. +func (o *ServerInfo) GetQuantity() string { + if o == nil || IsNil(o.Quantity) { + var ret string + return ret + } + return *o.Quantity +} + +// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerInfo) GetQuantityOk() (*string, bool) { + if o == nil || IsNil(o.Quantity) { + return nil, false + } + return o.Quantity, true +} + +// HasQuantity returns a boolean if a field has been set. +func (o *ServerInfo) HasQuantity() bool { + if o != nil && !IsNil(o.Quantity) { + return true + } + + return false +} + +// SetQuantity gets a reference to the given string and assigns it to the Quantity field. +func (o *ServerInfo) SetQuantity(v string) { + o.Quantity = &v +} + +func (o ServerInfo) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServerInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Facility) { + toSerialize["facility"] = o.Facility + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.Plan) { + toSerialize["plan"] = o.Plan + } + if !IsNil(o.Quantity) { + toSerialize["quantity"] = o.Quantity + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ServerInfo) UnmarshalJSON(data []byte) (err error) { + varServerInfo := _ServerInfo{} + + err = json.Unmarshal(data, &varServerInfo) + + if err != nil { + return err + } + + *o = ServerInfo(varServerInfo) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "facility") + delete(additionalProperties, "metro") + delete(additionalProperties, "plan") + delete(additionalProperties, "quantity") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableServerInfo struct { + value *ServerInfo + isSet bool +} + +func (v NullableServerInfo) Get() *ServerInfo { + return v.value +} + +func (v *NullableServerInfo) Set(val *ServerInfo) { + v.value = val + v.isSet = true +} + +func (v NullableServerInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableServerInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerInfo(val *ServerInfo) *NullableServerInfo { + return &NullableServerInfo{value: val, isSet: true} +} + +func (v NullableServerInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_list.go new file mode 100644 index 00000000..0d8b5aef --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SpotMarketPricesList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotMarketPricesList{} + +// SpotMarketPricesList struct for SpotMarketPricesList +type SpotMarketPricesList struct { + SpotMarketPrices *SpotPricesReport `json:"spot_market_prices,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotMarketPricesList SpotMarketPricesList + +// NewSpotMarketPricesList instantiates a new SpotMarketPricesList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotMarketPricesList() *SpotMarketPricesList { + this := SpotMarketPricesList{} + return &this +} + +// NewSpotMarketPricesListWithDefaults instantiates a new SpotMarketPricesList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotMarketPricesListWithDefaults() *SpotMarketPricesList { + this := SpotMarketPricesList{} + return &this +} + +// GetSpotMarketPrices returns the SpotMarketPrices field value if set, zero value otherwise. +func (o *SpotMarketPricesList) GetSpotMarketPrices() SpotPricesReport { + if o == nil || IsNil(o.SpotMarketPrices) { + var ret SpotPricesReport + return ret + } + return *o.SpotMarketPrices +} + +// GetSpotMarketPricesOk returns a tuple with the SpotMarketPrices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketPricesList) GetSpotMarketPricesOk() (*SpotPricesReport, bool) { + if o == nil || IsNil(o.SpotMarketPrices) { + return nil, false + } + return o.SpotMarketPrices, true +} + +// HasSpotMarketPrices returns a boolean if a field has been set. +func (o *SpotMarketPricesList) HasSpotMarketPrices() bool { + if o != nil && !IsNil(o.SpotMarketPrices) { + return true + } + + return false +} + +// SetSpotMarketPrices gets a reference to the given SpotPricesReport and assigns it to the SpotMarketPrices field. +func (o *SpotMarketPricesList) SetSpotMarketPrices(v SpotPricesReport) { + o.SpotMarketPrices = &v +} + +func (o SpotMarketPricesList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotMarketPricesList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.SpotMarketPrices) { + toSerialize["spot_market_prices"] = o.SpotMarketPrices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotMarketPricesList) UnmarshalJSON(data []byte) (err error) { + varSpotMarketPricesList := _SpotMarketPricesList{} + + err = json.Unmarshal(data, &varSpotMarketPricesList) + + if err != nil { + return err + } + + *o = SpotMarketPricesList(varSpotMarketPricesList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "spot_market_prices") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotMarketPricesList struct { + value *SpotMarketPricesList + isSet bool +} + +func (v NullableSpotMarketPricesList) Get() *SpotMarketPricesList { + return v.value +} + +func (v *NullableSpotMarketPricesList) Set(val *SpotMarketPricesList) { + v.value = val + v.isSet = true +} + +func (v NullableSpotMarketPricesList) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotMarketPricesList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotMarketPricesList(val *SpotMarketPricesList) *NullableSpotMarketPricesList { + return &NullableSpotMarketPricesList{value: val, isSet: true} +} + +func (v NullableSpotMarketPricesList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotMarketPricesList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_per_metro_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_per_metro_list.go new file mode 100644 index 00000000..6715fd01 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_per_metro_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SpotMarketPricesPerMetroList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotMarketPricesPerMetroList{} + +// SpotMarketPricesPerMetroList struct for SpotMarketPricesPerMetroList +type SpotMarketPricesPerMetroList struct { + SpotMarketPrices *SpotMarketPricesPerMetroReport `json:"spot_market_prices,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotMarketPricesPerMetroList SpotMarketPricesPerMetroList + +// NewSpotMarketPricesPerMetroList instantiates a new SpotMarketPricesPerMetroList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotMarketPricesPerMetroList() *SpotMarketPricesPerMetroList { + this := SpotMarketPricesPerMetroList{} + return &this +} + +// NewSpotMarketPricesPerMetroListWithDefaults instantiates a new SpotMarketPricesPerMetroList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotMarketPricesPerMetroListWithDefaults() *SpotMarketPricesPerMetroList { + this := SpotMarketPricesPerMetroList{} + return &this +} + +// GetSpotMarketPrices returns the SpotMarketPrices field value if set, zero value otherwise. +func (o *SpotMarketPricesPerMetroList) GetSpotMarketPrices() SpotMarketPricesPerMetroReport { + if o == nil || IsNil(o.SpotMarketPrices) { + var ret SpotMarketPricesPerMetroReport + return ret + } + return *o.SpotMarketPrices +} + +// GetSpotMarketPricesOk returns a tuple with the SpotMarketPrices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketPricesPerMetroList) GetSpotMarketPricesOk() (*SpotMarketPricesPerMetroReport, bool) { + if o == nil || IsNil(o.SpotMarketPrices) { + return nil, false + } + return o.SpotMarketPrices, true +} + +// HasSpotMarketPrices returns a boolean if a field has been set. +func (o *SpotMarketPricesPerMetroList) HasSpotMarketPrices() bool { + if o != nil && !IsNil(o.SpotMarketPrices) { + return true + } + + return false +} + +// SetSpotMarketPrices gets a reference to the given SpotMarketPricesPerMetroReport and assigns it to the SpotMarketPrices field. +func (o *SpotMarketPricesPerMetroList) SetSpotMarketPrices(v SpotMarketPricesPerMetroReport) { + o.SpotMarketPrices = &v +} + +func (o SpotMarketPricesPerMetroList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotMarketPricesPerMetroList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.SpotMarketPrices) { + toSerialize["spot_market_prices"] = o.SpotMarketPrices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotMarketPricesPerMetroList) UnmarshalJSON(data []byte) (err error) { + varSpotMarketPricesPerMetroList := _SpotMarketPricesPerMetroList{} + + err = json.Unmarshal(data, &varSpotMarketPricesPerMetroList) + + if err != nil { + return err + } + + *o = SpotMarketPricesPerMetroList(varSpotMarketPricesPerMetroList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "spot_market_prices") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotMarketPricesPerMetroList struct { + value *SpotMarketPricesPerMetroList + isSet bool +} + +func (v NullableSpotMarketPricesPerMetroList) Get() *SpotMarketPricesPerMetroList { + return v.value +} + +func (v *NullableSpotMarketPricesPerMetroList) Set(val *SpotMarketPricesPerMetroList) { + v.value = val + v.isSet = true +} + +func (v NullableSpotMarketPricesPerMetroList) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotMarketPricesPerMetroList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotMarketPricesPerMetroList(val *SpotMarketPricesPerMetroList) *NullableSpotMarketPricesPerMetroList { + return &NullableSpotMarketPricesPerMetroList{value: val, isSet: true} +} + +func (v NullableSpotMarketPricesPerMetroList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotMarketPricesPerMetroList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_per_metro_report.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_per_metro_report.go new file mode 100644 index 00000000..6b54303d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_prices_per_metro_report.go @@ -0,0 +1,376 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SpotMarketPricesPerMetroReport type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotMarketPricesPerMetroReport{} + +// SpotMarketPricesPerMetroReport struct for SpotMarketPricesPerMetroReport +type SpotMarketPricesPerMetroReport struct { + Am *SpotPricesPerFacility `json:"am,omitempty"` + Ch *SpotPricesPerFacility `json:"ch,omitempty"` + Da *SpotPricesPerFacility `json:"da,omitempty"` + La *SpotPricesPerFacility `json:"la,omitempty"` + Ny *SpotPricesPerFacility `json:"ny,omitempty"` + Sg *SpotPricesPerFacility `json:"sg,omitempty"` + Sv *SpotPricesPerFacility `json:"sv,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotMarketPricesPerMetroReport SpotMarketPricesPerMetroReport + +// NewSpotMarketPricesPerMetroReport instantiates a new SpotMarketPricesPerMetroReport object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotMarketPricesPerMetroReport() *SpotMarketPricesPerMetroReport { + this := SpotMarketPricesPerMetroReport{} + return &this +} + +// NewSpotMarketPricesPerMetroReportWithDefaults instantiates a new SpotMarketPricesPerMetroReport object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotMarketPricesPerMetroReportWithDefaults() *SpotMarketPricesPerMetroReport { + this := SpotMarketPricesPerMetroReport{} + return &this +} + +// GetAm returns the Am field value if set, zero value otherwise. +func (o *SpotMarketPricesPerMetroReport) GetAm() SpotPricesPerFacility { + if o == nil || IsNil(o.Am) { + var ret SpotPricesPerFacility + return ret + } + return *o.Am +} + +// GetAmOk returns a tuple with the Am field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketPricesPerMetroReport) GetAmOk() (*SpotPricesPerFacility, bool) { + if o == nil || IsNil(o.Am) { + return nil, false + } + return o.Am, true +} + +// HasAm returns a boolean if a field has been set. +func (o *SpotMarketPricesPerMetroReport) HasAm() bool { + if o != nil && !IsNil(o.Am) { + return true + } + + return false +} + +// SetAm gets a reference to the given SpotPricesPerFacility and assigns it to the Am field. +func (o *SpotMarketPricesPerMetroReport) SetAm(v SpotPricesPerFacility) { + o.Am = &v +} + +// GetCh returns the Ch field value if set, zero value otherwise. +func (o *SpotMarketPricesPerMetroReport) GetCh() SpotPricesPerFacility { + if o == nil || IsNil(o.Ch) { + var ret SpotPricesPerFacility + return ret + } + return *o.Ch +} + +// GetChOk returns a tuple with the Ch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketPricesPerMetroReport) GetChOk() (*SpotPricesPerFacility, bool) { + if o == nil || IsNil(o.Ch) { + return nil, false + } + return o.Ch, true +} + +// HasCh returns a boolean if a field has been set. +func (o *SpotMarketPricesPerMetroReport) HasCh() bool { + if o != nil && !IsNil(o.Ch) { + return true + } + + return false +} + +// SetCh gets a reference to the given SpotPricesPerFacility and assigns it to the Ch field. +func (o *SpotMarketPricesPerMetroReport) SetCh(v SpotPricesPerFacility) { + o.Ch = &v +} + +// GetDa returns the Da field value if set, zero value otherwise. +func (o *SpotMarketPricesPerMetroReport) GetDa() SpotPricesPerFacility { + if o == nil || IsNil(o.Da) { + var ret SpotPricesPerFacility + return ret + } + return *o.Da +} + +// GetDaOk returns a tuple with the Da field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketPricesPerMetroReport) GetDaOk() (*SpotPricesPerFacility, bool) { + if o == nil || IsNil(o.Da) { + return nil, false + } + return o.Da, true +} + +// HasDa returns a boolean if a field has been set. +func (o *SpotMarketPricesPerMetroReport) HasDa() bool { + if o != nil && !IsNil(o.Da) { + return true + } + + return false +} + +// SetDa gets a reference to the given SpotPricesPerFacility and assigns it to the Da field. +func (o *SpotMarketPricesPerMetroReport) SetDa(v SpotPricesPerFacility) { + o.Da = &v +} + +// GetLa returns the La field value if set, zero value otherwise. +func (o *SpotMarketPricesPerMetroReport) GetLa() SpotPricesPerFacility { + if o == nil || IsNil(o.La) { + var ret SpotPricesPerFacility + return ret + } + return *o.La +} + +// GetLaOk returns a tuple with the La field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketPricesPerMetroReport) GetLaOk() (*SpotPricesPerFacility, bool) { + if o == nil || IsNil(o.La) { + return nil, false + } + return o.La, true +} + +// HasLa returns a boolean if a field has been set. +func (o *SpotMarketPricesPerMetroReport) HasLa() bool { + if o != nil && !IsNil(o.La) { + return true + } + + return false +} + +// SetLa gets a reference to the given SpotPricesPerFacility and assigns it to the La field. +func (o *SpotMarketPricesPerMetroReport) SetLa(v SpotPricesPerFacility) { + o.La = &v +} + +// GetNy returns the Ny field value if set, zero value otherwise. +func (o *SpotMarketPricesPerMetroReport) GetNy() SpotPricesPerFacility { + if o == nil || IsNil(o.Ny) { + var ret SpotPricesPerFacility + return ret + } + return *o.Ny +} + +// GetNyOk returns a tuple with the Ny field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketPricesPerMetroReport) GetNyOk() (*SpotPricesPerFacility, bool) { + if o == nil || IsNil(o.Ny) { + return nil, false + } + return o.Ny, true +} + +// HasNy returns a boolean if a field has been set. +func (o *SpotMarketPricesPerMetroReport) HasNy() bool { + if o != nil && !IsNil(o.Ny) { + return true + } + + return false +} + +// SetNy gets a reference to the given SpotPricesPerFacility and assigns it to the Ny field. +func (o *SpotMarketPricesPerMetroReport) SetNy(v SpotPricesPerFacility) { + o.Ny = &v +} + +// GetSg returns the Sg field value if set, zero value otherwise. +func (o *SpotMarketPricesPerMetroReport) GetSg() SpotPricesPerFacility { + if o == nil || IsNil(o.Sg) { + var ret SpotPricesPerFacility + return ret + } + return *o.Sg +} + +// GetSgOk returns a tuple with the Sg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketPricesPerMetroReport) GetSgOk() (*SpotPricesPerFacility, bool) { + if o == nil || IsNil(o.Sg) { + return nil, false + } + return o.Sg, true +} + +// HasSg returns a boolean if a field has been set. +func (o *SpotMarketPricesPerMetroReport) HasSg() bool { + if o != nil && !IsNil(o.Sg) { + return true + } + + return false +} + +// SetSg gets a reference to the given SpotPricesPerFacility and assigns it to the Sg field. +func (o *SpotMarketPricesPerMetroReport) SetSg(v SpotPricesPerFacility) { + o.Sg = &v +} + +// GetSv returns the Sv field value if set, zero value otherwise. +func (o *SpotMarketPricesPerMetroReport) GetSv() SpotPricesPerFacility { + if o == nil || IsNil(o.Sv) { + var ret SpotPricesPerFacility + return ret + } + return *o.Sv +} + +// GetSvOk returns a tuple with the Sv field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketPricesPerMetroReport) GetSvOk() (*SpotPricesPerFacility, bool) { + if o == nil || IsNil(o.Sv) { + return nil, false + } + return o.Sv, true +} + +// HasSv returns a boolean if a field has been set. +func (o *SpotMarketPricesPerMetroReport) HasSv() bool { + if o != nil && !IsNil(o.Sv) { + return true + } + + return false +} + +// SetSv gets a reference to the given SpotPricesPerFacility and assigns it to the Sv field. +func (o *SpotMarketPricesPerMetroReport) SetSv(v SpotPricesPerFacility) { + o.Sv = &v +} + +func (o SpotMarketPricesPerMetroReport) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotMarketPricesPerMetroReport) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Am) { + toSerialize["am"] = o.Am + } + if !IsNil(o.Ch) { + toSerialize["ch"] = o.Ch + } + if !IsNil(o.Da) { + toSerialize["da"] = o.Da + } + if !IsNil(o.La) { + toSerialize["la"] = o.La + } + if !IsNil(o.Ny) { + toSerialize["ny"] = o.Ny + } + if !IsNil(o.Sg) { + toSerialize["sg"] = o.Sg + } + if !IsNil(o.Sv) { + toSerialize["sv"] = o.Sv + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotMarketPricesPerMetroReport) UnmarshalJSON(data []byte) (err error) { + varSpotMarketPricesPerMetroReport := _SpotMarketPricesPerMetroReport{} + + err = json.Unmarshal(data, &varSpotMarketPricesPerMetroReport) + + if err != nil { + return err + } + + *o = SpotMarketPricesPerMetroReport(varSpotMarketPricesPerMetroReport) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "am") + delete(additionalProperties, "ch") + delete(additionalProperties, "da") + delete(additionalProperties, "la") + delete(additionalProperties, "ny") + delete(additionalProperties, "sg") + delete(additionalProperties, "sv") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotMarketPricesPerMetroReport struct { + value *SpotMarketPricesPerMetroReport + isSet bool +} + +func (v NullableSpotMarketPricesPerMetroReport) Get() *SpotMarketPricesPerMetroReport { + return v.value +} + +func (v *NullableSpotMarketPricesPerMetroReport) Set(val *SpotMarketPricesPerMetroReport) { + v.value = val + v.isSet = true +} + +func (v NullableSpotMarketPricesPerMetroReport) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotMarketPricesPerMetroReport) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotMarketPricesPerMetroReport(val *SpotMarketPricesPerMetroReport) *NullableSpotMarketPricesPerMetroReport { + return &NullableSpotMarketPricesPerMetroReport{value: val, isSet: true} +} + +func (v NullableSpotMarketPricesPerMetroReport) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotMarketPricesPerMetroReport) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request.go new file mode 100644 index 00000000..4041b6ab --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request.go @@ -0,0 +1,525 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the SpotMarketRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotMarketRequest{} + +// SpotMarketRequest struct for SpotMarketRequest +type SpotMarketRequest struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + DevicesMax *int32 `json:"devices_max,omitempty"` + DevicesMin *int32 `json:"devices_min,omitempty"` + EndAt *time.Time `json:"end_at,omitempty"` + Facilities *Href `json:"facilities,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Instances *Href `json:"instances,omitempty"` + MaxBidPrice *float32 `json:"max_bid_price,omitempty"` + Metro *SpotMarketRequestMetro `json:"metro,omitempty"` + Project *Href `json:"project,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotMarketRequest SpotMarketRequest + +// NewSpotMarketRequest instantiates a new SpotMarketRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotMarketRequest() *SpotMarketRequest { + this := SpotMarketRequest{} + return &this +} + +// NewSpotMarketRequestWithDefaults instantiates a new SpotMarketRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotMarketRequestWithDefaults() *SpotMarketRequest { + this := SpotMarketRequest{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SpotMarketRequest) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequest) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *SpotMarketRequest) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *SpotMarketRequest) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDevicesMax returns the DevicesMax field value if set, zero value otherwise. +func (o *SpotMarketRequest) GetDevicesMax() int32 { + if o == nil || IsNil(o.DevicesMax) { + var ret int32 + return ret + } + return *o.DevicesMax +} + +// GetDevicesMaxOk returns a tuple with the DevicesMax field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequest) GetDevicesMaxOk() (*int32, bool) { + if o == nil || IsNil(o.DevicesMax) { + return nil, false + } + return o.DevicesMax, true +} + +// HasDevicesMax returns a boolean if a field has been set. +func (o *SpotMarketRequest) HasDevicesMax() bool { + if o != nil && !IsNil(o.DevicesMax) { + return true + } + + return false +} + +// SetDevicesMax gets a reference to the given int32 and assigns it to the DevicesMax field. +func (o *SpotMarketRequest) SetDevicesMax(v int32) { + o.DevicesMax = &v +} + +// GetDevicesMin returns the DevicesMin field value if set, zero value otherwise. +func (o *SpotMarketRequest) GetDevicesMin() int32 { + if o == nil || IsNil(o.DevicesMin) { + var ret int32 + return ret + } + return *o.DevicesMin +} + +// GetDevicesMinOk returns a tuple with the DevicesMin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequest) GetDevicesMinOk() (*int32, bool) { + if o == nil || IsNil(o.DevicesMin) { + return nil, false + } + return o.DevicesMin, true +} + +// HasDevicesMin returns a boolean if a field has been set. +func (o *SpotMarketRequest) HasDevicesMin() bool { + if o != nil && !IsNil(o.DevicesMin) { + return true + } + + return false +} + +// SetDevicesMin gets a reference to the given int32 and assigns it to the DevicesMin field. +func (o *SpotMarketRequest) SetDevicesMin(v int32) { + o.DevicesMin = &v +} + +// GetEndAt returns the EndAt field value if set, zero value otherwise. +func (o *SpotMarketRequest) GetEndAt() time.Time { + if o == nil || IsNil(o.EndAt) { + var ret time.Time + return ret + } + return *o.EndAt +} + +// GetEndAtOk returns a tuple with the EndAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequest) GetEndAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.EndAt) { + return nil, false + } + return o.EndAt, true +} + +// HasEndAt returns a boolean if a field has been set. +func (o *SpotMarketRequest) HasEndAt() bool { + if o != nil && !IsNil(o.EndAt) { + return true + } + + return false +} + +// SetEndAt gets a reference to the given time.Time and assigns it to the EndAt field. +func (o *SpotMarketRequest) SetEndAt(v time.Time) { + o.EndAt = &v +} + +// GetFacilities returns the Facilities field value if set, zero value otherwise. +func (o *SpotMarketRequest) GetFacilities() Href { + if o == nil || IsNil(o.Facilities) { + var ret Href + return ret + } + return *o.Facilities +} + +// GetFacilitiesOk returns a tuple with the Facilities field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequest) GetFacilitiesOk() (*Href, bool) { + if o == nil || IsNil(o.Facilities) { + return nil, false + } + return o.Facilities, true +} + +// HasFacilities returns a boolean if a field has been set. +func (o *SpotMarketRequest) HasFacilities() bool { + if o != nil && !IsNil(o.Facilities) { + return true + } + + return false +} + +// SetFacilities gets a reference to the given Href and assigns it to the Facilities field. +func (o *SpotMarketRequest) SetFacilities(v Href) { + o.Facilities = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *SpotMarketRequest) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequest) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *SpotMarketRequest) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *SpotMarketRequest) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SpotMarketRequest) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequest) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SpotMarketRequest) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SpotMarketRequest) SetId(v string) { + o.Id = &v +} + +// GetInstances returns the Instances field value if set, zero value otherwise. +func (o *SpotMarketRequest) GetInstances() Href { + if o == nil || IsNil(o.Instances) { + var ret Href + return ret + } + return *o.Instances +} + +// GetInstancesOk returns a tuple with the Instances field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequest) GetInstancesOk() (*Href, bool) { + if o == nil || IsNil(o.Instances) { + return nil, false + } + return o.Instances, true +} + +// HasInstances returns a boolean if a field has been set. +func (o *SpotMarketRequest) HasInstances() bool { + if o != nil && !IsNil(o.Instances) { + return true + } + + return false +} + +// SetInstances gets a reference to the given Href and assigns it to the Instances field. +func (o *SpotMarketRequest) SetInstances(v Href) { + o.Instances = &v +} + +// GetMaxBidPrice returns the MaxBidPrice field value if set, zero value otherwise. +func (o *SpotMarketRequest) GetMaxBidPrice() float32 { + if o == nil || IsNil(o.MaxBidPrice) { + var ret float32 + return ret + } + return *o.MaxBidPrice +} + +// GetMaxBidPriceOk returns a tuple with the MaxBidPrice field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequest) GetMaxBidPriceOk() (*float32, bool) { + if o == nil || IsNil(o.MaxBidPrice) { + return nil, false + } + return o.MaxBidPrice, true +} + +// HasMaxBidPrice returns a boolean if a field has been set. +func (o *SpotMarketRequest) HasMaxBidPrice() bool { + if o != nil && !IsNil(o.MaxBidPrice) { + return true + } + + return false +} + +// SetMaxBidPrice gets a reference to the given float32 and assigns it to the MaxBidPrice field. +func (o *SpotMarketRequest) SetMaxBidPrice(v float32) { + o.MaxBidPrice = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *SpotMarketRequest) GetMetro() SpotMarketRequestMetro { + if o == nil || IsNil(o.Metro) { + var ret SpotMarketRequestMetro + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequest) GetMetroOk() (*SpotMarketRequestMetro, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *SpotMarketRequest) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given SpotMarketRequestMetro and assigns it to the Metro field. +func (o *SpotMarketRequest) SetMetro(v SpotMarketRequestMetro) { + o.Metro = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *SpotMarketRequest) GetProject() Href { + if o == nil || IsNil(o.Project) { + var ret Href + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequest) GetProjectOk() (*Href, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *SpotMarketRequest) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Href and assigns it to the Project field. +func (o *SpotMarketRequest) SetProject(v Href) { + o.Project = &v +} + +func (o SpotMarketRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotMarketRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.DevicesMax) { + toSerialize["devices_max"] = o.DevicesMax + } + if !IsNil(o.DevicesMin) { + toSerialize["devices_min"] = o.DevicesMin + } + if !IsNil(o.EndAt) { + toSerialize["end_at"] = o.EndAt + } + if !IsNil(o.Facilities) { + toSerialize["facilities"] = o.Facilities + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Instances) { + toSerialize["instances"] = o.Instances + } + if !IsNil(o.MaxBidPrice) { + toSerialize["max_bid_price"] = o.MaxBidPrice + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotMarketRequest) UnmarshalJSON(data []byte) (err error) { + varSpotMarketRequest := _SpotMarketRequest{} + + err = json.Unmarshal(data, &varSpotMarketRequest) + + if err != nil { + return err + } + + *o = SpotMarketRequest(varSpotMarketRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "devices_max") + delete(additionalProperties, "devices_min") + delete(additionalProperties, "end_at") + delete(additionalProperties, "facilities") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "instances") + delete(additionalProperties, "max_bid_price") + delete(additionalProperties, "metro") + delete(additionalProperties, "project") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotMarketRequest struct { + value *SpotMarketRequest + isSet bool +} + +func (v NullableSpotMarketRequest) Get() *SpotMarketRequest { + return v.value +} + +func (v *NullableSpotMarketRequest) Set(val *SpotMarketRequest) { + v.value = val + v.isSet = true +} + +func (v NullableSpotMarketRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotMarketRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotMarketRequest(val *SpotMarketRequest) *NullableSpotMarketRequest { + return &NullableSpotMarketRequest{value: val, isSet: true} +} + +func (v NullableSpotMarketRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotMarketRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_create_input.go new file mode 100644 index 00000000..d219226b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_create_input.go @@ -0,0 +1,382 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the SpotMarketRequestCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotMarketRequestCreateInput{} + +// SpotMarketRequestCreateInput struct for SpotMarketRequestCreateInput +type SpotMarketRequestCreateInput struct { + DevicesMax *int32 `json:"devices_max,omitempty"` + DevicesMin *int32 `json:"devices_min,omitempty"` + EndAt *time.Time `json:"end_at,omitempty"` + // Deprecated + Facilities []string `json:"facilities,omitempty"` + InstanceParameters *SpotMarketRequestCreateInputInstanceParameters `json:"instance_parameters,omitempty"` + MaxBidPrice *float32 `json:"max_bid_price,omitempty"` + // The metro ID or code the spot market request will be created in. + Metro *string `json:"metro,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotMarketRequestCreateInput SpotMarketRequestCreateInput + +// NewSpotMarketRequestCreateInput instantiates a new SpotMarketRequestCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotMarketRequestCreateInput() *SpotMarketRequestCreateInput { + this := SpotMarketRequestCreateInput{} + return &this +} + +// NewSpotMarketRequestCreateInputWithDefaults instantiates a new SpotMarketRequestCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotMarketRequestCreateInputWithDefaults() *SpotMarketRequestCreateInput { + this := SpotMarketRequestCreateInput{} + return &this +} + +// GetDevicesMax returns the DevicesMax field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInput) GetDevicesMax() int32 { + if o == nil || IsNil(o.DevicesMax) { + var ret int32 + return ret + } + return *o.DevicesMax +} + +// GetDevicesMaxOk returns a tuple with the DevicesMax field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInput) GetDevicesMaxOk() (*int32, bool) { + if o == nil || IsNil(o.DevicesMax) { + return nil, false + } + return o.DevicesMax, true +} + +// HasDevicesMax returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInput) HasDevicesMax() bool { + if o != nil && !IsNil(o.DevicesMax) { + return true + } + + return false +} + +// SetDevicesMax gets a reference to the given int32 and assigns it to the DevicesMax field. +func (o *SpotMarketRequestCreateInput) SetDevicesMax(v int32) { + o.DevicesMax = &v +} + +// GetDevicesMin returns the DevicesMin field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInput) GetDevicesMin() int32 { + if o == nil || IsNil(o.DevicesMin) { + var ret int32 + return ret + } + return *o.DevicesMin +} + +// GetDevicesMinOk returns a tuple with the DevicesMin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInput) GetDevicesMinOk() (*int32, bool) { + if o == nil || IsNil(o.DevicesMin) { + return nil, false + } + return o.DevicesMin, true +} + +// HasDevicesMin returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInput) HasDevicesMin() bool { + if o != nil && !IsNil(o.DevicesMin) { + return true + } + + return false +} + +// SetDevicesMin gets a reference to the given int32 and assigns it to the DevicesMin field. +func (o *SpotMarketRequestCreateInput) SetDevicesMin(v int32) { + o.DevicesMin = &v +} + +// GetEndAt returns the EndAt field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInput) GetEndAt() time.Time { + if o == nil || IsNil(o.EndAt) { + var ret time.Time + return ret + } + return *o.EndAt +} + +// GetEndAtOk returns a tuple with the EndAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInput) GetEndAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.EndAt) { + return nil, false + } + return o.EndAt, true +} + +// HasEndAt returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInput) HasEndAt() bool { + if o != nil && !IsNil(o.EndAt) { + return true + } + + return false +} + +// SetEndAt gets a reference to the given time.Time and assigns it to the EndAt field. +func (o *SpotMarketRequestCreateInput) SetEndAt(v time.Time) { + o.EndAt = &v +} + +// GetFacilities returns the Facilities field value if set, zero value otherwise. +// Deprecated +func (o *SpotMarketRequestCreateInput) GetFacilities() []string { + if o == nil || IsNil(o.Facilities) { + var ret []string + return ret + } + return o.Facilities +} + +// GetFacilitiesOk returns a tuple with the Facilities field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *SpotMarketRequestCreateInput) GetFacilitiesOk() ([]string, bool) { + if o == nil || IsNil(o.Facilities) { + return nil, false + } + return o.Facilities, true +} + +// HasFacilities returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInput) HasFacilities() bool { + if o != nil && !IsNil(o.Facilities) { + return true + } + + return false +} + +// SetFacilities gets a reference to the given []string and assigns it to the Facilities field. +// Deprecated +func (o *SpotMarketRequestCreateInput) SetFacilities(v []string) { + o.Facilities = v +} + +// GetInstanceParameters returns the InstanceParameters field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInput) GetInstanceParameters() SpotMarketRequestCreateInputInstanceParameters { + if o == nil || IsNil(o.InstanceParameters) { + var ret SpotMarketRequestCreateInputInstanceParameters + return ret + } + return *o.InstanceParameters +} + +// GetInstanceParametersOk returns a tuple with the InstanceParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInput) GetInstanceParametersOk() (*SpotMarketRequestCreateInputInstanceParameters, bool) { + if o == nil || IsNil(o.InstanceParameters) { + return nil, false + } + return o.InstanceParameters, true +} + +// HasInstanceParameters returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInput) HasInstanceParameters() bool { + if o != nil && !IsNil(o.InstanceParameters) { + return true + } + + return false +} + +// SetInstanceParameters gets a reference to the given SpotMarketRequestCreateInputInstanceParameters and assigns it to the InstanceParameters field. +func (o *SpotMarketRequestCreateInput) SetInstanceParameters(v SpotMarketRequestCreateInputInstanceParameters) { + o.InstanceParameters = &v +} + +// GetMaxBidPrice returns the MaxBidPrice field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInput) GetMaxBidPrice() float32 { + if o == nil || IsNil(o.MaxBidPrice) { + var ret float32 + return ret + } + return *o.MaxBidPrice +} + +// GetMaxBidPriceOk returns a tuple with the MaxBidPrice field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInput) GetMaxBidPriceOk() (*float32, bool) { + if o == nil || IsNil(o.MaxBidPrice) { + return nil, false + } + return o.MaxBidPrice, true +} + +// HasMaxBidPrice returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInput) HasMaxBidPrice() bool { + if o != nil && !IsNil(o.MaxBidPrice) { + return true + } + + return false +} + +// SetMaxBidPrice gets a reference to the given float32 and assigns it to the MaxBidPrice field. +func (o *SpotMarketRequestCreateInput) SetMaxBidPrice(v float32) { + o.MaxBidPrice = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInput) GetMetro() string { + if o == nil || IsNil(o.Metro) { + var ret string + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInput) GetMetroOk() (*string, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInput) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given string and assigns it to the Metro field. +func (o *SpotMarketRequestCreateInput) SetMetro(v string) { + o.Metro = &v +} + +func (o SpotMarketRequestCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotMarketRequestCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DevicesMax) { + toSerialize["devices_max"] = o.DevicesMax + } + if !IsNil(o.DevicesMin) { + toSerialize["devices_min"] = o.DevicesMin + } + if !IsNil(o.EndAt) { + toSerialize["end_at"] = o.EndAt + } + if !IsNil(o.Facilities) { + toSerialize["facilities"] = o.Facilities + } + if !IsNil(o.InstanceParameters) { + toSerialize["instance_parameters"] = o.InstanceParameters + } + if !IsNil(o.MaxBidPrice) { + toSerialize["max_bid_price"] = o.MaxBidPrice + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotMarketRequestCreateInput) UnmarshalJSON(data []byte) (err error) { + varSpotMarketRequestCreateInput := _SpotMarketRequestCreateInput{} + + err = json.Unmarshal(data, &varSpotMarketRequestCreateInput) + + if err != nil { + return err + } + + *o = SpotMarketRequestCreateInput(varSpotMarketRequestCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "devices_max") + delete(additionalProperties, "devices_min") + delete(additionalProperties, "end_at") + delete(additionalProperties, "facilities") + delete(additionalProperties, "instance_parameters") + delete(additionalProperties, "max_bid_price") + delete(additionalProperties, "metro") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotMarketRequestCreateInput struct { + value *SpotMarketRequestCreateInput + isSet bool +} + +func (v NullableSpotMarketRequestCreateInput) Get() *SpotMarketRequestCreateInput { + return v.value +} + +func (v *NullableSpotMarketRequestCreateInput) Set(val *SpotMarketRequestCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableSpotMarketRequestCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotMarketRequestCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotMarketRequestCreateInput(val *SpotMarketRequestCreateInput) *NullableSpotMarketRequestCreateInput { + return &NullableSpotMarketRequestCreateInput{value: val, isSet: true} +} + +func (v NullableSpotMarketRequestCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotMarketRequestCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_create_input_instance_parameters.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_create_input_instance_parameters.go new file mode 100644 index 00000000..68588b59 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_create_input_instance_parameters.go @@ -0,0 +1,786 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the SpotMarketRequestCreateInputInstanceParameters type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotMarketRequestCreateInputInstanceParameters{} + +// SpotMarketRequestCreateInputInstanceParameters struct for SpotMarketRequestCreateInputInstanceParameters +type SpotMarketRequestCreateInputInstanceParameters struct { + AlwaysPxe *bool `json:"always_pxe,omitempty"` + BillingCycle *string `json:"billing_cycle,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Description *string `json:"description,omitempty"` + Features []string `json:"features,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Hostnames []string `json:"hostnames,omitempty"` + // Whether the device should be locked, preventing accidental deletion. + Locked *bool `json:"locked,omitempty"` + NoSshKeys *bool `json:"no_ssh_keys,omitempty"` + OperatingSystem *string `json:"operating_system,omitempty"` + Plan *string `json:"plan,omitempty"` + PrivateIpv4SubnetSize *int32 `json:"private_ipv4_subnet_size,omitempty"` + ProjectSshKeys []string `json:"project_ssh_keys,omitempty"` + PublicIpv4SubnetSize *int32 `json:"public_ipv4_subnet_size,omitempty"` + Tags []string `json:"tags,omitempty"` + TerminationTime *time.Time `json:"termination_time,omitempty"` + // The UUIDs of users whose SSH keys should be included on the provisioned device. + UserSshKeys []string `json:"user_ssh_keys,omitempty"` + Userdata *string `json:"userdata,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotMarketRequestCreateInputInstanceParameters SpotMarketRequestCreateInputInstanceParameters + +// NewSpotMarketRequestCreateInputInstanceParameters instantiates a new SpotMarketRequestCreateInputInstanceParameters object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotMarketRequestCreateInputInstanceParameters() *SpotMarketRequestCreateInputInstanceParameters { + this := SpotMarketRequestCreateInputInstanceParameters{} + return &this +} + +// NewSpotMarketRequestCreateInputInstanceParametersWithDefaults instantiates a new SpotMarketRequestCreateInputInstanceParameters object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotMarketRequestCreateInputInstanceParametersWithDefaults() *SpotMarketRequestCreateInputInstanceParameters { + this := SpotMarketRequestCreateInputInstanceParameters{} + return &this +} + +// GetAlwaysPxe returns the AlwaysPxe field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetAlwaysPxe() bool { + if o == nil || IsNil(o.AlwaysPxe) { + var ret bool + return ret + } + return *o.AlwaysPxe +} + +// GetAlwaysPxeOk returns a tuple with the AlwaysPxe field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetAlwaysPxeOk() (*bool, bool) { + if o == nil || IsNil(o.AlwaysPxe) { + return nil, false + } + return o.AlwaysPxe, true +} + +// HasAlwaysPxe returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasAlwaysPxe() bool { + if o != nil && !IsNil(o.AlwaysPxe) { + return true + } + + return false +} + +// SetAlwaysPxe gets a reference to the given bool and assigns it to the AlwaysPxe field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetAlwaysPxe(v bool) { + o.AlwaysPxe = &v +} + +// GetBillingCycle returns the BillingCycle field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetBillingCycle() string { + if o == nil || IsNil(o.BillingCycle) { + var ret string + return ret + } + return *o.BillingCycle +} + +// GetBillingCycleOk returns a tuple with the BillingCycle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetBillingCycleOk() (*string, bool) { + if o == nil || IsNil(o.BillingCycle) { + return nil, false + } + return o.BillingCycle, true +} + +// HasBillingCycle returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasBillingCycle() bool { + if o != nil && !IsNil(o.BillingCycle) { + return true + } + + return false +} + +// SetBillingCycle gets a reference to the given string and assigns it to the BillingCycle field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetBillingCycle(v string) { + o.BillingCycle = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetDescription(v string) { + o.Description = &v +} + +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetFeatures() []string { + if o == nil || IsNil(o.Features) { + var ret []string + return ret + } + return o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetFeaturesOk() ([]string, bool) { + if o == nil || IsNil(o.Features) { + return nil, false + } + return o.Features, true +} + +// HasFeatures returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasFeatures() bool { + if o != nil && !IsNil(o.Features) { + return true + } + + return false +} + +// SetFeatures gets a reference to the given []string and assigns it to the Features field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetFeatures(v []string) { + o.Features = v +} + +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetHostname() string { + if o == nil || IsNil(o.Hostname) { + var ret string + return ret + } + return *o.Hostname +} + +// GetHostnameOk returns a tuple with the Hostname field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetHostnameOk() (*string, bool) { + if o == nil || IsNil(o.Hostname) { + return nil, false + } + return o.Hostname, true +} + +// HasHostname returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasHostname() bool { + if o != nil && !IsNil(o.Hostname) { + return true + } + + return false +} + +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetHostname(v string) { + o.Hostname = &v +} + +// GetHostnames returns the Hostnames field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetHostnames() []string { + if o == nil || IsNil(o.Hostnames) { + var ret []string + return ret + } + return o.Hostnames +} + +// GetHostnamesOk returns a tuple with the Hostnames field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetHostnamesOk() ([]string, bool) { + if o == nil || IsNil(o.Hostnames) { + return nil, false + } + return o.Hostnames, true +} + +// HasHostnames returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasHostnames() bool { + if o != nil && !IsNil(o.Hostnames) { + return true + } + + return false +} + +// SetHostnames gets a reference to the given []string and assigns it to the Hostnames field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetHostnames(v []string) { + o.Hostnames = v +} + +// GetLocked returns the Locked field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetLocked() bool { + if o == nil || IsNil(o.Locked) { + var ret bool + return ret + } + return *o.Locked +} + +// GetLockedOk returns a tuple with the Locked field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetLockedOk() (*bool, bool) { + if o == nil || IsNil(o.Locked) { + return nil, false + } + return o.Locked, true +} + +// HasLocked returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasLocked() bool { + if o != nil && !IsNil(o.Locked) { + return true + } + + return false +} + +// SetLocked gets a reference to the given bool and assigns it to the Locked field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetLocked(v bool) { + o.Locked = &v +} + +// GetNoSshKeys returns the NoSshKeys field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetNoSshKeys() bool { + if o == nil || IsNil(o.NoSshKeys) { + var ret bool + return ret + } + return *o.NoSshKeys +} + +// GetNoSshKeysOk returns a tuple with the NoSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetNoSshKeysOk() (*bool, bool) { + if o == nil || IsNil(o.NoSshKeys) { + return nil, false + } + return o.NoSshKeys, true +} + +// HasNoSshKeys returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasNoSshKeys() bool { + if o != nil && !IsNil(o.NoSshKeys) { + return true + } + + return false +} + +// SetNoSshKeys gets a reference to the given bool and assigns it to the NoSshKeys field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetNoSshKeys(v bool) { + o.NoSshKeys = &v +} + +// GetOperatingSystem returns the OperatingSystem field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetOperatingSystem() string { + if o == nil || IsNil(o.OperatingSystem) { + var ret string + return ret + } + return *o.OperatingSystem +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetOperatingSystemOk() (*string, bool) { + if o == nil || IsNil(o.OperatingSystem) { + return nil, false + } + return o.OperatingSystem, true +} + +// HasOperatingSystem returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasOperatingSystem() bool { + if o != nil && !IsNil(o.OperatingSystem) { + return true + } + + return false +} + +// SetOperatingSystem gets a reference to the given string and assigns it to the OperatingSystem field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetOperatingSystem(v string) { + o.OperatingSystem = &v +} + +// GetPlan returns the Plan field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetPlan() string { + if o == nil || IsNil(o.Plan) { + var ret string + return ret + } + return *o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetPlanOk() (*string, bool) { + if o == nil || IsNil(o.Plan) { + return nil, false + } + return o.Plan, true +} + +// HasPlan returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasPlan() bool { + if o != nil && !IsNil(o.Plan) { + return true + } + + return false +} + +// SetPlan gets a reference to the given string and assigns it to the Plan field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetPlan(v string) { + o.Plan = &v +} + +// GetPrivateIpv4SubnetSize returns the PrivateIpv4SubnetSize field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetPrivateIpv4SubnetSize() int32 { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + var ret int32 + return ret + } + return *o.PrivateIpv4SubnetSize +} + +// GetPrivateIpv4SubnetSizeOk returns a tuple with the PrivateIpv4SubnetSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetPrivateIpv4SubnetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PrivateIpv4SubnetSize) { + return nil, false + } + return o.PrivateIpv4SubnetSize, true +} + +// HasPrivateIpv4SubnetSize returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasPrivateIpv4SubnetSize() bool { + if o != nil && !IsNil(o.PrivateIpv4SubnetSize) { + return true + } + + return false +} + +// SetPrivateIpv4SubnetSize gets a reference to the given int32 and assigns it to the PrivateIpv4SubnetSize field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetPrivateIpv4SubnetSize(v int32) { + o.PrivateIpv4SubnetSize = &v +} + +// GetProjectSshKeys returns the ProjectSshKeys field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetProjectSshKeys() []string { + if o == nil || IsNil(o.ProjectSshKeys) { + var ret []string + return ret + } + return o.ProjectSshKeys +} + +// GetProjectSshKeysOk returns a tuple with the ProjectSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetProjectSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.ProjectSshKeys) { + return nil, false + } + return o.ProjectSshKeys, true +} + +// HasProjectSshKeys returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasProjectSshKeys() bool { + if o != nil && !IsNil(o.ProjectSshKeys) { + return true + } + + return false +} + +// SetProjectSshKeys gets a reference to the given []string and assigns it to the ProjectSshKeys field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetProjectSshKeys(v []string) { + o.ProjectSshKeys = v +} + +// GetPublicIpv4SubnetSize returns the PublicIpv4SubnetSize field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetPublicIpv4SubnetSize() int32 { + if o == nil || IsNil(o.PublicIpv4SubnetSize) { + var ret int32 + return ret + } + return *o.PublicIpv4SubnetSize +} + +// GetPublicIpv4SubnetSizeOk returns a tuple with the PublicIpv4SubnetSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetPublicIpv4SubnetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.PublicIpv4SubnetSize) { + return nil, false + } + return o.PublicIpv4SubnetSize, true +} + +// HasPublicIpv4SubnetSize returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasPublicIpv4SubnetSize() bool { + if o != nil && !IsNil(o.PublicIpv4SubnetSize) { + return true + } + + return false +} + +// SetPublicIpv4SubnetSize gets a reference to the given int32 and assigns it to the PublicIpv4SubnetSize field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetPublicIpv4SubnetSize(v int32) { + o.PublicIpv4SubnetSize = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetTags(v []string) { + o.Tags = v +} + +// GetTerminationTime returns the TerminationTime field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetTerminationTime() time.Time { + if o == nil || IsNil(o.TerminationTime) { + var ret time.Time + return ret + } + return *o.TerminationTime +} + +// GetTerminationTimeOk returns a tuple with the TerminationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetTerminationTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.TerminationTime) { + return nil, false + } + return o.TerminationTime, true +} + +// HasTerminationTime returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasTerminationTime() bool { + if o != nil && !IsNil(o.TerminationTime) { + return true + } + + return false +} + +// SetTerminationTime gets a reference to the given time.Time and assigns it to the TerminationTime field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetTerminationTime(v time.Time) { + o.TerminationTime = &v +} + +// GetUserSshKeys returns the UserSshKeys field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetUserSshKeys() []string { + if o == nil || IsNil(o.UserSshKeys) { + var ret []string + return ret + } + return o.UserSshKeys +} + +// GetUserSshKeysOk returns a tuple with the UserSshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetUserSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.UserSshKeys) { + return nil, false + } + return o.UserSshKeys, true +} + +// HasUserSshKeys returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasUserSshKeys() bool { + if o != nil && !IsNil(o.UserSshKeys) { + return true + } + + return false +} + +// SetUserSshKeys gets a reference to the given []string and assigns it to the UserSshKeys field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetUserSshKeys(v []string) { + o.UserSshKeys = v +} + +// GetUserdata returns the Userdata field value if set, zero value otherwise. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetUserdata() string { + if o == nil || IsNil(o.Userdata) { + var ret string + return ret + } + return *o.Userdata +} + +// GetUserdataOk returns a tuple with the Userdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) GetUserdataOk() (*string, bool) { + if o == nil || IsNil(o.Userdata) { + return nil, false + } + return o.Userdata, true +} + +// HasUserdata returns a boolean if a field has been set. +func (o *SpotMarketRequestCreateInputInstanceParameters) HasUserdata() bool { + if o != nil && !IsNil(o.Userdata) { + return true + } + + return false +} + +// SetUserdata gets a reference to the given string and assigns it to the Userdata field. +func (o *SpotMarketRequestCreateInputInstanceParameters) SetUserdata(v string) { + o.Userdata = &v +} + +func (o SpotMarketRequestCreateInputInstanceParameters) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotMarketRequestCreateInputInstanceParameters) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AlwaysPxe) { + toSerialize["always_pxe"] = o.AlwaysPxe + } + if !IsNil(o.BillingCycle) { + toSerialize["billing_cycle"] = o.BillingCycle + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Features) { + toSerialize["features"] = o.Features + } + if !IsNil(o.Hostname) { + toSerialize["hostname"] = o.Hostname + } + if !IsNil(o.Hostnames) { + toSerialize["hostnames"] = o.Hostnames + } + if !IsNil(o.Locked) { + toSerialize["locked"] = o.Locked + } + if !IsNil(o.NoSshKeys) { + toSerialize["no_ssh_keys"] = o.NoSshKeys + } + if !IsNil(o.OperatingSystem) { + toSerialize["operating_system"] = o.OperatingSystem + } + if !IsNil(o.Plan) { + toSerialize["plan"] = o.Plan + } + if !IsNil(o.PrivateIpv4SubnetSize) { + toSerialize["private_ipv4_subnet_size"] = o.PrivateIpv4SubnetSize + } + if !IsNil(o.ProjectSshKeys) { + toSerialize["project_ssh_keys"] = o.ProjectSshKeys + } + if !IsNil(o.PublicIpv4SubnetSize) { + toSerialize["public_ipv4_subnet_size"] = o.PublicIpv4SubnetSize + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.TerminationTime) { + toSerialize["termination_time"] = o.TerminationTime + } + if !IsNil(o.UserSshKeys) { + toSerialize["user_ssh_keys"] = o.UserSshKeys + } + if !IsNil(o.Userdata) { + toSerialize["userdata"] = o.Userdata + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotMarketRequestCreateInputInstanceParameters) UnmarshalJSON(data []byte) (err error) { + varSpotMarketRequestCreateInputInstanceParameters := _SpotMarketRequestCreateInputInstanceParameters{} + + err = json.Unmarshal(data, &varSpotMarketRequestCreateInputInstanceParameters) + + if err != nil { + return err + } + + *o = SpotMarketRequestCreateInputInstanceParameters(varSpotMarketRequestCreateInputInstanceParameters) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "always_pxe") + delete(additionalProperties, "billing_cycle") + delete(additionalProperties, "customdata") + delete(additionalProperties, "description") + delete(additionalProperties, "features") + delete(additionalProperties, "hostname") + delete(additionalProperties, "hostnames") + delete(additionalProperties, "locked") + delete(additionalProperties, "no_ssh_keys") + delete(additionalProperties, "operating_system") + delete(additionalProperties, "plan") + delete(additionalProperties, "private_ipv4_subnet_size") + delete(additionalProperties, "project_ssh_keys") + delete(additionalProperties, "public_ipv4_subnet_size") + delete(additionalProperties, "tags") + delete(additionalProperties, "termination_time") + delete(additionalProperties, "user_ssh_keys") + delete(additionalProperties, "userdata") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotMarketRequestCreateInputInstanceParameters struct { + value *SpotMarketRequestCreateInputInstanceParameters + isSet bool +} + +func (v NullableSpotMarketRequestCreateInputInstanceParameters) Get() *SpotMarketRequestCreateInputInstanceParameters { + return v.value +} + +func (v *NullableSpotMarketRequestCreateInputInstanceParameters) Set(val *SpotMarketRequestCreateInputInstanceParameters) { + v.value = val + v.isSet = true +} + +func (v NullableSpotMarketRequestCreateInputInstanceParameters) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotMarketRequestCreateInputInstanceParameters) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotMarketRequestCreateInputInstanceParameters(val *SpotMarketRequestCreateInputInstanceParameters) *NullableSpotMarketRequestCreateInputInstanceParameters { + return &NullableSpotMarketRequestCreateInputInstanceParameters{value: val, isSet: true} +} + +func (v NullableSpotMarketRequestCreateInputInstanceParameters) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotMarketRequestCreateInputInstanceParameters) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_list.go new file mode 100644 index 00000000..542bf70e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SpotMarketRequestList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotMarketRequestList{} + +// SpotMarketRequestList struct for SpotMarketRequestList +type SpotMarketRequestList struct { + SpotMarketRequests []SpotMarketRequest `json:"spot_market_requests,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotMarketRequestList SpotMarketRequestList + +// NewSpotMarketRequestList instantiates a new SpotMarketRequestList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotMarketRequestList() *SpotMarketRequestList { + this := SpotMarketRequestList{} + return &this +} + +// NewSpotMarketRequestListWithDefaults instantiates a new SpotMarketRequestList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotMarketRequestListWithDefaults() *SpotMarketRequestList { + this := SpotMarketRequestList{} + return &this +} + +// GetSpotMarketRequests returns the SpotMarketRequests field value if set, zero value otherwise. +func (o *SpotMarketRequestList) GetSpotMarketRequests() []SpotMarketRequest { + if o == nil || IsNil(o.SpotMarketRequests) { + var ret []SpotMarketRequest + return ret + } + return o.SpotMarketRequests +} + +// GetSpotMarketRequestsOk returns a tuple with the SpotMarketRequests field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestList) GetSpotMarketRequestsOk() ([]SpotMarketRequest, bool) { + if o == nil || IsNil(o.SpotMarketRequests) { + return nil, false + } + return o.SpotMarketRequests, true +} + +// HasSpotMarketRequests returns a boolean if a field has been set. +func (o *SpotMarketRequestList) HasSpotMarketRequests() bool { + if o != nil && !IsNil(o.SpotMarketRequests) { + return true + } + + return false +} + +// SetSpotMarketRequests gets a reference to the given []SpotMarketRequest and assigns it to the SpotMarketRequests field. +func (o *SpotMarketRequestList) SetSpotMarketRequests(v []SpotMarketRequest) { + o.SpotMarketRequests = v +} + +func (o SpotMarketRequestList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotMarketRequestList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.SpotMarketRequests) { + toSerialize["spot_market_requests"] = o.SpotMarketRequests + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotMarketRequestList) UnmarshalJSON(data []byte) (err error) { + varSpotMarketRequestList := _SpotMarketRequestList{} + + err = json.Unmarshal(data, &varSpotMarketRequestList) + + if err != nil { + return err + } + + *o = SpotMarketRequestList(varSpotMarketRequestList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "spot_market_requests") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotMarketRequestList struct { + value *SpotMarketRequestList + isSet bool +} + +func (v NullableSpotMarketRequestList) Get() *SpotMarketRequestList { + return v.value +} + +func (v *NullableSpotMarketRequestList) Set(val *SpotMarketRequestList) { + v.value = val + v.isSet = true +} + +func (v NullableSpotMarketRequestList) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotMarketRequestList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotMarketRequestList(val *SpotMarketRequestList) *NullableSpotMarketRequestList { + return &NullableSpotMarketRequestList{value: val, isSet: true} +} + +func (v NullableSpotMarketRequestList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotMarketRequestList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_metro.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_metro.go new file mode 100644 index 00000000..96d6600c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_market_request_metro.go @@ -0,0 +1,265 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SpotMarketRequestMetro type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotMarketRequestMetro{} + +// SpotMarketRequestMetro struct for SpotMarketRequestMetro +type SpotMarketRequestMetro struct { + Code *string `json:"code,omitempty"` + Country *string `json:"country,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotMarketRequestMetro SpotMarketRequestMetro + +// NewSpotMarketRequestMetro instantiates a new SpotMarketRequestMetro object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotMarketRequestMetro() *SpotMarketRequestMetro { + this := SpotMarketRequestMetro{} + return &this +} + +// NewSpotMarketRequestMetroWithDefaults instantiates a new SpotMarketRequestMetro object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotMarketRequestMetroWithDefaults() *SpotMarketRequestMetro { + this := SpotMarketRequestMetro{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *SpotMarketRequestMetro) GetCode() string { + if o == nil || IsNil(o.Code) { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestMetro) GetCodeOk() (*string, bool) { + if o == nil || IsNil(o.Code) { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *SpotMarketRequestMetro) HasCode() bool { + if o != nil && !IsNil(o.Code) { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *SpotMarketRequestMetro) SetCode(v string) { + o.Code = &v +} + +// GetCountry returns the Country field value if set, zero value otherwise. +func (o *SpotMarketRequestMetro) GetCountry() string { + if o == nil || IsNil(o.Country) { + var ret string + return ret + } + return *o.Country +} + +// GetCountryOk returns a tuple with the Country field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestMetro) GetCountryOk() (*string, bool) { + if o == nil || IsNil(o.Country) { + return nil, false + } + return o.Country, true +} + +// HasCountry returns a boolean if a field has been set. +func (o *SpotMarketRequestMetro) HasCountry() bool { + if o != nil && !IsNil(o.Country) { + return true + } + + return false +} + +// SetCountry gets a reference to the given string and assigns it to the Country field. +func (o *SpotMarketRequestMetro) SetCountry(v string) { + o.Country = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SpotMarketRequestMetro) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestMetro) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SpotMarketRequestMetro) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SpotMarketRequestMetro) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SpotMarketRequestMetro) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotMarketRequestMetro) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SpotMarketRequestMetro) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SpotMarketRequestMetro) SetName(v string) { + o.Name = &v +} + +func (o SpotMarketRequestMetro) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotMarketRequestMetro) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Code) { + toSerialize["code"] = o.Code + } + if !IsNil(o.Country) { + toSerialize["country"] = o.Country + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotMarketRequestMetro) UnmarshalJSON(data []byte) (err error) { + varSpotMarketRequestMetro := _SpotMarketRequestMetro{} + + err = json.Unmarshal(data, &varSpotMarketRequestMetro) + + if err != nil { + return err + } + + *o = SpotMarketRequestMetro(varSpotMarketRequestMetro) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "country") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotMarketRequestMetro struct { + value *SpotMarketRequestMetro + isSet bool +} + +func (v NullableSpotMarketRequestMetro) Get() *SpotMarketRequestMetro { + return v.value +} + +func (v *NullableSpotMarketRequestMetro) Set(val *SpotMarketRequestMetro) { + v.value = val + v.isSet = true +} + +func (v NullableSpotMarketRequestMetro) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotMarketRequestMetro) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotMarketRequestMetro(val *SpotMarketRequestMetro) *NullableSpotMarketRequestMetro { + return &NullableSpotMarketRequestMetro{value: val, isSet: true} +} + +func (v NullableSpotMarketRequestMetro) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotMarketRequestMetro) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_datapoints.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_datapoints.go new file mode 100644 index 00000000..88682275 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_datapoints.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SpotPricesDatapoints type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotPricesDatapoints{} + +// SpotPricesDatapoints struct for SpotPricesDatapoints +type SpotPricesDatapoints struct { + Datapoints [][]float32 `json:"datapoints,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotPricesDatapoints SpotPricesDatapoints + +// NewSpotPricesDatapoints instantiates a new SpotPricesDatapoints object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotPricesDatapoints() *SpotPricesDatapoints { + this := SpotPricesDatapoints{} + return &this +} + +// NewSpotPricesDatapointsWithDefaults instantiates a new SpotPricesDatapoints object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotPricesDatapointsWithDefaults() *SpotPricesDatapoints { + this := SpotPricesDatapoints{} + return &this +} + +// GetDatapoints returns the Datapoints field value if set, zero value otherwise. +func (o *SpotPricesDatapoints) GetDatapoints() [][]float32 { + if o == nil || IsNil(o.Datapoints) { + var ret [][]float32 + return ret + } + return o.Datapoints +} + +// GetDatapointsOk returns a tuple with the Datapoints field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesDatapoints) GetDatapointsOk() ([][]float32, bool) { + if o == nil || IsNil(o.Datapoints) { + return nil, false + } + return o.Datapoints, true +} + +// HasDatapoints returns a boolean if a field has been set. +func (o *SpotPricesDatapoints) HasDatapoints() bool { + if o != nil && !IsNil(o.Datapoints) { + return true + } + + return false +} + +// SetDatapoints gets a reference to the given [][]float32 and assigns it to the Datapoints field. +func (o *SpotPricesDatapoints) SetDatapoints(v [][]float32) { + o.Datapoints = v +} + +func (o SpotPricesDatapoints) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotPricesDatapoints) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Datapoints) { + toSerialize["datapoints"] = o.Datapoints + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotPricesDatapoints) UnmarshalJSON(data []byte) (err error) { + varSpotPricesDatapoints := _SpotPricesDatapoints{} + + err = json.Unmarshal(data, &varSpotPricesDatapoints) + + if err != nil { + return err + } + + *o = SpotPricesDatapoints(varSpotPricesDatapoints) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "datapoints") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotPricesDatapoints struct { + value *SpotPricesDatapoints + isSet bool +} + +func (v NullableSpotPricesDatapoints) Get() *SpotPricesDatapoints { + return v.value +} + +func (v *NullableSpotPricesDatapoints) Set(val *SpotPricesDatapoints) { + v.value = val + v.isSet = true +} + +func (v NullableSpotPricesDatapoints) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotPricesDatapoints) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotPricesDatapoints(val *SpotPricesDatapoints) *NullableSpotPricesDatapoints { + return &NullableSpotPricesDatapoints{value: val, isSet: true} +} + +func (v NullableSpotPricesDatapoints) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotPricesDatapoints) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_history_report.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_history_report.go new file mode 100644 index 00000000..b0ba77dc --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_history_report.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SpotPricesHistoryReport type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotPricesHistoryReport{} + +// SpotPricesHistoryReport struct for SpotPricesHistoryReport +type SpotPricesHistoryReport struct { + PricesHistory *SpotPricesDatapoints `json:"prices_history,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotPricesHistoryReport SpotPricesHistoryReport + +// NewSpotPricesHistoryReport instantiates a new SpotPricesHistoryReport object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotPricesHistoryReport() *SpotPricesHistoryReport { + this := SpotPricesHistoryReport{} + return &this +} + +// NewSpotPricesHistoryReportWithDefaults instantiates a new SpotPricesHistoryReport object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotPricesHistoryReportWithDefaults() *SpotPricesHistoryReport { + this := SpotPricesHistoryReport{} + return &this +} + +// GetPricesHistory returns the PricesHistory field value if set, zero value otherwise. +func (o *SpotPricesHistoryReport) GetPricesHistory() SpotPricesDatapoints { + if o == nil || IsNil(o.PricesHistory) { + var ret SpotPricesDatapoints + return ret + } + return *o.PricesHistory +} + +// GetPricesHistoryOk returns a tuple with the PricesHistory field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesHistoryReport) GetPricesHistoryOk() (*SpotPricesDatapoints, bool) { + if o == nil || IsNil(o.PricesHistory) { + return nil, false + } + return o.PricesHistory, true +} + +// HasPricesHistory returns a boolean if a field has been set. +func (o *SpotPricesHistoryReport) HasPricesHistory() bool { + if o != nil && !IsNil(o.PricesHistory) { + return true + } + + return false +} + +// SetPricesHistory gets a reference to the given SpotPricesDatapoints and assigns it to the PricesHistory field. +func (o *SpotPricesHistoryReport) SetPricesHistory(v SpotPricesDatapoints) { + o.PricesHistory = &v +} + +func (o SpotPricesHistoryReport) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotPricesHistoryReport) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.PricesHistory) { + toSerialize["prices_history"] = o.PricesHistory + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotPricesHistoryReport) UnmarshalJSON(data []byte) (err error) { + varSpotPricesHistoryReport := _SpotPricesHistoryReport{} + + err = json.Unmarshal(data, &varSpotPricesHistoryReport) + + if err != nil { + return err + } + + *o = SpotPricesHistoryReport(varSpotPricesHistoryReport) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "prices_history") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotPricesHistoryReport struct { + value *SpotPricesHistoryReport + isSet bool +} + +func (v NullableSpotPricesHistoryReport) Get() *SpotPricesHistoryReport { + return v.value +} + +func (v *NullableSpotPricesHistoryReport) Set(val *SpotPricesHistoryReport) { + v.value = val + v.isSet = true +} + +func (v NullableSpotPricesHistoryReport) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotPricesHistoryReport) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotPricesHistoryReport(val *SpotPricesHistoryReport) *NullableSpotPricesHistoryReport { + return &NullableSpotPricesHistoryReport{value: val, isSet: true} +} + +func (v NullableSpotPricesHistoryReport) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotPricesHistoryReport) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_baremetal.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_baremetal.go new file mode 100644 index 00000000..a3bc02df --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_baremetal.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SpotPricesPerBaremetal type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotPricesPerBaremetal{} + +// SpotPricesPerBaremetal struct for SpotPricesPerBaremetal +type SpotPricesPerBaremetal struct { + Price *float32 `json:"price,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotPricesPerBaremetal SpotPricesPerBaremetal + +// NewSpotPricesPerBaremetal instantiates a new SpotPricesPerBaremetal object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotPricesPerBaremetal() *SpotPricesPerBaremetal { + this := SpotPricesPerBaremetal{} + return &this +} + +// NewSpotPricesPerBaremetalWithDefaults instantiates a new SpotPricesPerBaremetal object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotPricesPerBaremetalWithDefaults() *SpotPricesPerBaremetal { + this := SpotPricesPerBaremetal{} + return &this +} + +// GetPrice returns the Price field value if set, zero value otherwise. +func (o *SpotPricesPerBaremetal) GetPrice() float32 { + if o == nil || IsNil(o.Price) { + var ret float32 + return ret + } + return *o.Price +} + +// GetPriceOk returns a tuple with the Price field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesPerBaremetal) GetPriceOk() (*float32, bool) { + if o == nil || IsNil(o.Price) { + return nil, false + } + return o.Price, true +} + +// HasPrice returns a boolean if a field has been set. +func (o *SpotPricesPerBaremetal) HasPrice() bool { + if o != nil && !IsNil(o.Price) { + return true + } + + return false +} + +// SetPrice gets a reference to the given float32 and assigns it to the Price field. +func (o *SpotPricesPerBaremetal) SetPrice(v float32) { + o.Price = &v +} + +func (o SpotPricesPerBaremetal) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotPricesPerBaremetal) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Price) { + toSerialize["price"] = o.Price + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotPricesPerBaremetal) UnmarshalJSON(data []byte) (err error) { + varSpotPricesPerBaremetal := _SpotPricesPerBaremetal{} + + err = json.Unmarshal(data, &varSpotPricesPerBaremetal) + + if err != nil { + return err + } + + *o = SpotPricesPerBaremetal(varSpotPricesPerBaremetal) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "price") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotPricesPerBaremetal struct { + value *SpotPricesPerBaremetal + isSet bool +} + +func (v NullableSpotPricesPerBaremetal) Get() *SpotPricesPerBaremetal { + return v.value +} + +func (v *NullableSpotPricesPerBaremetal) Set(val *SpotPricesPerBaremetal) { + v.value = val + v.isSet = true +} + +func (v NullableSpotPricesPerBaremetal) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotPricesPerBaremetal) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotPricesPerBaremetal(val *SpotPricesPerBaremetal) *NullableSpotPricesPerBaremetal { + return &NullableSpotPricesPerBaremetal{value: val, isSet: true} +} + +func (v NullableSpotPricesPerBaremetal) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotPricesPerBaremetal) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_facility.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_facility.go new file mode 100644 index 00000000..99dd13b1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_facility.go @@ -0,0 +1,450 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SpotPricesPerFacility type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotPricesPerFacility{} + +// SpotPricesPerFacility struct for SpotPricesPerFacility +type SpotPricesPerFacility struct { + Baremetal0 *SpotPricesPerBaremetal `json:"baremetal_0,omitempty"` + Baremetal1 *SpotPricesPerBaremetal `json:"baremetal_1,omitempty"` + Baremetal2 *SpotPricesPerBaremetal `json:"baremetal_2,omitempty"` + Baremetal2a *SpotPricesPerBaremetal `json:"baremetal_2a,omitempty"` + Baremetal2a2 *SpotPricesPerBaremetal `json:"baremetal_2a2,omitempty"` + Baremetal3 *SpotPricesPerBaremetal `json:"baremetal_3,omitempty"` + BaremetalS *SpotPricesPerBaremetal `json:"baremetal_s,omitempty"` + C2MediumX86 *SpotPricesPerBaremetal `json:"c2.medium.x86,omitempty"` + M2XlargeX86 *SpotPricesPerBaremetal `json:"m2.xlarge.x86,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotPricesPerFacility SpotPricesPerFacility + +// NewSpotPricesPerFacility instantiates a new SpotPricesPerFacility object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotPricesPerFacility() *SpotPricesPerFacility { + this := SpotPricesPerFacility{} + return &this +} + +// NewSpotPricesPerFacilityWithDefaults instantiates a new SpotPricesPerFacility object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotPricesPerFacilityWithDefaults() *SpotPricesPerFacility { + this := SpotPricesPerFacility{} + return &this +} + +// GetBaremetal0 returns the Baremetal0 field value if set, zero value otherwise. +func (o *SpotPricesPerFacility) GetBaremetal0() SpotPricesPerBaremetal { + if o == nil || IsNil(o.Baremetal0) { + var ret SpotPricesPerBaremetal + return ret + } + return *o.Baremetal0 +} + +// GetBaremetal0Ok returns a tuple with the Baremetal0 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesPerFacility) GetBaremetal0Ok() (*SpotPricesPerBaremetal, bool) { + if o == nil || IsNil(o.Baremetal0) { + return nil, false + } + return o.Baremetal0, true +} + +// HasBaremetal0 returns a boolean if a field has been set. +func (o *SpotPricesPerFacility) HasBaremetal0() bool { + if o != nil && !IsNil(o.Baremetal0) { + return true + } + + return false +} + +// SetBaremetal0 gets a reference to the given SpotPricesPerBaremetal and assigns it to the Baremetal0 field. +func (o *SpotPricesPerFacility) SetBaremetal0(v SpotPricesPerBaremetal) { + o.Baremetal0 = &v +} + +// GetBaremetal1 returns the Baremetal1 field value if set, zero value otherwise. +func (o *SpotPricesPerFacility) GetBaremetal1() SpotPricesPerBaremetal { + if o == nil || IsNil(o.Baremetal1) { + var ret SpotPricesPerBaremetal + return ret + } + return *o.Baremetal1 +} + +// GetBaremetal1Ok returns a tuple with the Baremetal1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesPerFacility) GetBaremetal1Ok() (*SpotPricesPerBaremetal, bool) { + if o == nil || IsNil(o.Baremetal1) { + return nil, false + } + return o.Baremetal1, true +} + +// HasBaremetal1 returns a boolean if a field has been set. +func (o *SpotPricesPerFacility) HasBaremetal1() bool { + if o != nil && !IsNil(o.Baremetal1) { + return true + } + + return false +} + +// SetBaremetal1 gets a reference to the given SpotPricesPerBaremetal and assigns it to the Baremetal1 field. +func (o *SpotPricesPerFacility) SetBaremetal1(v SpotPricesPerBaremetal) { + o.Baremetal1 = &v +} + +// GetBaremetal2 returns the Baremetal2 field value if set, zero value otherwise. +func (o *SpotPricesPerFacility) GetBaremetal2() SpotPricesPerBaremetal { + if o == nil || IsNil(o.Baremetal2) { + var ret SpotPricesPerBaremetal + return ret + } + return *o.Baremetal2 +} + +// GetBaremetal2Ok returns a tuple with the Baremetal2 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesPerFacility) GetBaremetal2Ok() (*SpotPricesPerBaremetal, bool) { + if o == nil || IsNil(o.Baremetal2) { + return nil, false + } + return o.Baremetal2, true +} + +// HasBaremetal2 returns a boolean if a field has been set. +func (o *SpotPricesPerFacility) HasBaremetal2() bool { + if o != nil && !IsNil(o.Baremetal2) { + return true + } + + return false +} + +// SetBaremetal2 gets a reference to the given SpotPricesPerBaremetal and assigns it to the Baremetal2 field. +func (o *SpotPricesPerFacility) SetBaremetal2(v SpotPricesPerBaremetal) { + o.Baremetal2 = &v +} + +// GetBaremetal2a returns the Baremetal2a field value if set, zero value otherwise. +func (o *SpotPricesPerFacility) GetBaremetal2a() SpotPricesPerBaremetal { + if o == nil || IsNil(o.Baremetal2a) { + var ret SpotPricesPerBaremetal + return ret + } + return *o.Baremetal2a +} + +// GetBaremetal2aOk returns a tuple with the Baremetal2a field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesPerFacility) GetBaremetal2aOk() (*SpotPricesPerBaremetal, bool) { + if o == nil || IsNil(o.Baremetal2a) { + return nil, false + } + return o.Baremetal2a, true +} + +// HasBaremetal2a returns a boolean if a field has been set. +func (o *SpotPricesPerFacility) HasBaremetal2a() bool { + if o != nil && !IsNil(o.Baremetal2a) { + return true + } + + return false +} + +// SetBaremetal2a gets a reference to the given SpotPricesPerBaremetal and assigns it to the Baremetal2a field. +func (o *SpotPricesPerFacility) SetBaremetal2a(v SpotPricesPerBaremetal) { + o.Baremetal2a = &v +} + +// GetBaremetal2a2 returns the Baremetal2a2 field value if set, zero value otherwise. +func (o *SpotPricesPerFacility) GetBaremetal2a2() SpotPricesPerBaremetal { + if o == nil || IsNil(o.Baremetal2a2) { + var ret SpotPricesPerBaremetal + return ret + } + return *o.Baremetal2a2 +} + +// GetBaremetal2a2Ok returns a tuple with the Baremetal2a2 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesPerFacility) GetBaremetal2a2Ok() (*SpotPricesPerBaremetal, bool) { + if o == nil || IsNil(o.Baremetal2a2) { + return nil, false + } + return o.Baremetal2a2, true +} + +// HasBaremetal2a2 returns a boolean if a field has been set. +func (o *SpotPricesPerFacility) HasBaremetal2a2() bool { + if o != nil && !IsNil(o.Baremetal2a2) { + return true + } + + return false +} + +// SetBaremetal2a2 gets a reference to the given SpotPricesPerBaremetal and assigns it to the Baremetal2a2 field. +func (o *SpotPricesPerFacility) SetBaremetal2a2(v SpotPricesPerBaremetal) { + o.Baremetal2a2 = &v +} + +// GetBaremetal3 returns the Baremetal3 field value if set, zero value otherwise. +func (o *SpotPricesPerFacility) GetBaremetal3() SpotPricesPerBaremetal { + if o == nil || IsNil(o.Baremetal3) { + var ret SpotPricesPerBaremetal + return ret + } + return *o.Baremetal3 +} + +// GetBaremetal3Ok returns a tuple with the Baremetal3 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesPerFacility) GetBaremetal3Ok() (*SpotPricesPerBaremetal, bool) { + if o == nil || IsNil(o.Baremetal3) { + return nil, false + } + return o.Baremetal3, true +} + +// HasBaremetal3 returns a boolean if a field has been set. +func (o *SpotPricesPerFacility) HasBaremetal3() bool { + if o != nil && !IsNil(o.Baremetal3) { + return true + } + + return false +} + +// SetBaremetal3 gets a reference to the given SpotPricesPerBaremetal and assigns it to the Baremetal3 field. +func (o *SpotPricesPerFacility) SetBaremetal3(v SpotPricesPerBaremetal) { + o.Baremetal3 = &v +} + +// GetBaremetalS returns the BaremetalS field value if set, zero value otherwise. +func (o *SpotPricesPerFacility) GetBaremetalS() SpotPricesPerBaremetal { + if o == nil || IsNil(o.BaremetalS) { + var ret SpotPricesPerBaremetal + return ret + } + return *o.BaremetalS +} + +// GetBaremetalSOk returns a tuple with the BaremetalS field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesPerFacility) GetBaremetalSOk() (*SpotPricesPerBaremetal, bool) { + if o == nil || IsNil(o.BaremetalS) { + return nil, false + } + return o.BaremetalS, true +} + +// HasBaremetalS returns a boolean if a field has been set. +func (o *SpotPricesPerFacility) HasBaremetalS() bool { + if o != nil && !IsNil(o.BaremetalS) { + return true + } + + return false +} + +// SetBaremetalS gets a reference to the given SpotPricesPerBaremetal and assigns it to the BaremetalS field. +func (o *SpotPricesPerFacility) SetBaremetalS(v SpotPricesPerBaremetal) { + o.BaremetalS = &v +} + +// GetC2MediumX86 returns the C2MediumX86 field value if set, zero value otherwise. +func (o *SpotPricesPerFacility) GetC2MediumX86() SpotPricesPerBaremetal { + if o == nil || IsNil(o.C2MediumX86) { + var ret SpotPricesPerBaremetal + return ret + } + return *o.C2MediumX86 +} + +// GetC2MediumX86Ok returns a tuple with the C2MediumX86 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesPerFacility) GetC2MediumX86Ok() (*SpotPricesPerBaremetal, bool) { + if o == nil || IsNil(o.C2MediumX86) { + return nil, false + } + return o.C2MediumX86, true +} + +// HasC2MediumX86 returns a boolean if a field has been set. +func (o *SpotPricesPerFacility) HasC2MediumX86() bool { + if o != nil && !IsNil(o.C2MediumX86) { + return true + } + + return false +} + +// SetC2MediumX86 gets a reference to the given SpotPricesPerBaremetal and assigns it to the C2MediumX86 field. +func (o *SpotPricesPerFacility) SetC2MediumX86(v SpotPricesPerBaremetal) { + o.C2MediumX86 = &v +} + +// GetM2XlargeX86 returns the M2XlargeX86 field value if set, zero value otherwise. +func (o *SpotPricesPerFacility) GetM2XlargeX86() SpotPricesPerBaremetal { + if o == nil || IsNil(o.M2XlargeX86) { + var ret SpotPricesPerBaremetal + return ret + } + return *o.M2XlargeX86 +} + +// GetM2XlargeX86Ok returns a tuple with the M2XlargeX86 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesPerFacility) GetM2XlargeX86Ok() (*SpotPricesPerBaremetal, bool) { + if o == nil || IsNil(o.M2XlargeX86) { + return nil, false + } + return o.M2XlargeX86, true +} + +// HasM2XlargeX86 returns a boolean if a field has been set. +func (o *SpotPricesPerFacility) HasM2XlargeX86() bool { + if o != nil && !IsNil(o.M2XlargeX86) { + return true + } + + return false +} + +// SetM2XlargeX86 gets a reference to the given SpotPricesPerBaremetal and assigns it to the M2XlargeX86 field. +func (o *SpotPricesPerFacility) SetM2XlargeX86(v SpotPricesPerBaremetal) { + o.M2XlargeX86 = &v +} + +func (o SpotPricesPerFacility) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotPricesPerFacility) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Baremetal0) { + toSerialize["baremetal_0"] = o.Baremetal0 + } + if !IsNil(o.Baremetal1) { + toSerialize["baremetal_1"] = o.Baremetal1 + } + if !IsNil(o.Baremetal2) { + toSerialize["baremetal_2"] = o.Baremetal2 + } + if !IsNil(o.Baremetal2a) { + toSerialize["baremetal_2a"] = o.Baremetal2a + } + if !IsNil(o.Baremetal2a2) { + toSerialize["baremetal_2a2"] = o.Baremetal2a2 + } + if !IsNil(o.Baremetal3) { + toSerialize["baremetal_3"] = o.Baremetal3 + } + if !IsNil(o.BaremetalS) { + toSerialize["baremetal_s"] = o.BaremetalS + } + if !IsNil(o.C2MediumX86) { + toSerialize["c2.medium.x86"] = o.C2MediumX86 + } + if !IsNil(o.M2XlargeX86) { + toSerialize["m2.xlarge.x86"] = o.M2XlargeX86 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotPricesPerFacility) UnmarshalJSON(data []byte) (err error) { + varSpotPricesPerFacility := _SpotPricesPerFacility{} + + err = json.Unmarshal(data, &varSpotPricesPerFacility) + + if err != nil { + return err + } + + *o = SpotPricesPerFacility(varSpotPricesPerFacility) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "baremetal_0") + delete(additionalProperties, "baremetal_1") + delete(additionalProperties, "baremetal_2") + delete(additionalProperties, "baremetal_2a") + delete(additionalProperties, "baremetal_2a2") + delete(additionalProperties, "baremetal_3") + delete(additionalProperties, "baremetal_s") + delete(additionalProperties, "c2.medium.x86") + delete(additionalProperties, "m2.xlarge.x86") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotPricesPerFacility struct { + value *SpotPricesPerFacility + isSet bool +} + +func (v NullableSpotPricesPerFacility) Get() *SpotPricesPerFacility { + return v.value +} + +func (v *NullableSpotPricesPerFacility) Set(val *SpotPricesPerFacility) { + v.value = val + v.isSet = true +} + +func (v NullableSpotPricesPerFacility) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotPricesPerFacility) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotPricesPerFacility(val *SpotPricesPerFacility) *NullableSpotPricesPerFacility { + return &NullableSpotPricesPerFacility{value: val, isSet: true} +} + +func (v NullableSpotPricesPerFacility) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotPricesPerFacility) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_new_facility.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_new_facility.go new file mode 100644 index 00000000..c83e0ae8 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_per_new_facility.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SpotPricesPerNewFacility type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotPricesPerNewFacility{} + +// SpotPricesPerNewFacility struct for SpotPricesPerNewFacility +type SpotPricesPerNewFacility struct { + Baremetal1e *SpotPricesPerBaremetal `json:"baremetal_1e,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotPricesPerNewFacility SpotPricesPerNewFacility + +// NewSpotPricesPerNewFacility instantiates a new SpotPricesPerNewFacility object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotPricesPerNewFacility() *SpotPricesPerNewFacility { + this := SpotPricesPerNewFacility{} + return &this +} + +// NewSpotPricesPerNewFacilityWithDefaults instantiates a new SpotPricesPerNewFacility object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotPricesPerNewFacilityWithDefaults() *SpotPricesPerNewFacility { + this := SpotPricesPerNewFacility{} + return &this +} + +// GetBaremetal1e returns the Baremetal1e field value if set, zero value otherwise. +func (o *SpotPricesPerNewFacility) GetBaremetal1e() SpotPricesPerBaremetal { + if o == nil || IsNil(o.Baremetal1e) { + var ret SpotPricesPerBaremetal + return ret + } + return *o.Baremetal1e +} + +// GetBaremetal1eOk returns a tuple with the Baremetal1e field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesPerNewFacility) GetBaremetal1eOk() (*SpotPricesPerBaremetal, bool) { + if o == nil || IsNil(o.Baremetal1e) { + return nil, false + } + return o.Baremetal1e, true +} + +// HasBaremetal1e returns a boolean if a field has been set. +func (o *SpotPricesPerNewFacility) HasBaremetal1e() bool { + if o != nil && !IsNil(o.Baremetal1e) { + return true + } + + return false +} + +// SetBaremetal1e gets a reference to the given SpotPricesPerBaremetal and assigns it to the Baremetal1e field. +func (o *SpotPricesPerNewFacility) SetBaremetal1e(v SpotPricesPerBaremetal) { + o.Baremetal1e = &v +} + +func (o SpotPricesPerNewFacility) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotPricesPerNewFacility) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Baremetal1e) { + toSerialize["baremetal_1e"] = o.Baremetal1e + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotPricesPerNewFacility) UnmarshalJSON(data []byte) (err error) { + varSpotPricesPerNewFacility := _SpotPricesPerNewFacility{} + + err = json.Unmarshal(data, &varSpotPricesPerNewFacility) + + if err != nil { + return err + } + + *o = SpotPricesPerNewFacility(varSpotPricesPerNewFacility) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "baremetal_1e") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotPricesPerNewFacility struct { + value *SpotPricesPerNewFacility + isSet bool +} + +func (v NullableSpotPricesPerNewFacility) Get() *SpotPricesPerNewFacility { + return v.value +} + +func (v *NullableSpotPricesPerNewFacility) Set(val *SpotPricesPerNewFacility) { + v.value = val + v.isSet = true +} + +func (v NullableSpotPricesPerNewFacility) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotPricesPerNewFacility) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotPricesPerNewFacility(val *SpotPricesPerNewFacility) *NullableSpotPricesPerNewFacility { + return &NullableSpotPricesPerNewFacility{value: val, isSet: true} +} + +func (v NullableSpotPricesPerNewFacility) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotPricesPerNewFacility) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_report.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_report.go new file mode 100644 index 00000000..b78425bf --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_spot_prices_report.go @@ -0,0 +1,635 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SpotPricesReport type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SpotPricesReport{} + +// SpotPricesReport struct for SpotPricesReport +type SpotPricesReport struct { + Ams1 *SpotPricesPerFacility `json:"ams1,omitempty"` + Atl1 *SpotPricesPerNewFacility `json:"atl1,omitempty"` + Dfw1 *SpotPricesPerNewFacility `json:"dfw1,omitempty"` + Ewr1 *SpotPricesPerFacility `json:"ewr1,omitempty"` + Fra1 *SpotPricesPerNewFacility `json:"fra1,omitempty"` + Iad1 *SpotPricesPerNewFacility `json:"iad1,omitempty"` + Lax1 *SpotPricesPerNewFacility `json:"lax1,omitempty"` + Nrt1 *SpotPricesPerFacility `json:"nrt1,omitempty"` + Ord1 *SpotPricesPerNewFacility `json:"ord1,omitempty"` + Sea1 *SpotPricesPerNewFacility `json:"sea1,omitempty"` + Sin1 *SpotPricesPerNewFacility `json:"sin1,omitempty"` + Sjc1 *SpotPricesPerFacility `json:"sjc1,omitempty"` + Syd1 *SpotPricesPerNewFacility `json:"syd1,omitempty"` + Yyz1 *SpotPricesPerNewFacility `json:"yyz1,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SpotPricesReport SpotPricesReport + +// NewSpotPricesReport instantiates a new SpotPricesReport object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSpotPricesReport() *SpotPricesReport { + this := SpotPricesReport{} + return &this +} + +// NewSpotPricesReportWithDefaults instantiates a new SpotPricesReport object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSpotPricesReportWithDefaults() *SpotPricesReport { + this := SpotPricesReport{} + return &this +} + +// GetAms1 returns the Ams1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetAms1() SpotPricesPerFacility { + if o == nil || IsNil(o.Ams1) { + var ret SpotPricesPerFacility + return ret + } + return *o.Ams1 +} + +// GetAms1Ok returns a tuple with the Ams1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetAms1Ok() (*SpotPricesPerFacility, bool) { + if o == nil || IsNil(o.Ams1) { + return nil, false + } + return o.Ams1, true +} + +// HasAms1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasAms1() bool { + if o != nil && !IsNil(o.Ams1) { + return true + } + + return false +} + +// SetAms1 gets a reference to the given SpotPricesPerFacility and assigns it to the Ams1 field. +func (o *SpotPricesReport) SetAms1(v SpotPricesPerFacility) { + o.Ams1 = &v +} + +// GetAtl1 returns the Atl1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetAtl1() SpotPricesPerNewFacility { + if o == nil || IsNil(o.Atl1) { + var ret SpotPricesPerNewFacility + return ret + } + return *o.Atl1 +} + +// GetAtl1Ok returns a tuple with the Atl1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetAtl1Ok() (*SpotPricesPerNewFacility, bool) { + if o == nil || IsNil(o.Atl1) { + return nil, false + } + return o.Atl1, true +} + +// HasAtl1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasAtl1() bool { + if o != nil && !IsNil(o.Atl1) { + return true + } + + return false +} + +// SetAtl1 gets a reference to the given SpotPricesPerNewFacility and assigns it to the Atl1 field. +func (o *SpotPricesReport) SetAtl1(v SpotPricesPerNewFacility) { + o.Atl1 = &v +} + +// GetDfw1 returns the Dfw1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetDfw1() SpotPricesPerNewFacility { + if o == nil || IsNil(o.Dfw1) { + var ret SpotPricesPerNewFacility + return ret + } + return *o.Dfw1 +} + +// GetDfw1Ok returns a tuple with the Dfw1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetDfw1Ok() (*SpotPricesPerNewFacility, bool) { + if o == nil || IsNil(o.Dfw1) { + return nil, false + } + return o.Dfw1, true +} + +// HasDfw1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasDfw1() bool { + if o != nil && !IsNil(o.Dfw1) { + return true + } + + return false +} + +// SetDfw1 gets a reference to the given SpotPricesPerNewFacility and assigns it to the Dfw1 field. +func (o *SpotPricesReport) SetDfw1(v SpotPricesPerNewFacility) { + o.Dfw1 = &v +} + +// GetEwr1 returns the Ewr1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetEwr1() SpotPricesPerFacility { + if o == nil || IsNil(o.Ewr1) { + var ret SpotPricesPerFacility + return ret + } + return *o.Ewr1 +} + +// GetEwr1Ok returns a tuple with the Ewr1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetEwr1Ok() (*SpotPricesPerFacility, bool) { + if o == nil || IsNil(o.Ewr1) { + return nil, false + } + return o.Ewr1, true +} + +// HasEwr1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasEwr1() bool { + if o != nil && !IsNil(o.Ewr1) { + return true + } + + return false +} + +// SetEwr1 gets a reference to the given SpotPricesPerFacility and assigns it to the Ewr1 field. +func (o *SpotPricesReport) SetEwr1(v SpotPricesPerFacility) { + o.Ewr1 = &v +} + +// GetFra1 returns the Fra1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetFra1() SpotPricesPerNewFacility { + if o == nil || IsNil(o.Fra1) { + var ret SpotPricesPerNewFacility + return ret + } + return *o.Fra1 +} + +// GetFra1Ok returns a tuple with the Fra1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetFra1Ok() (*SpotPricesPerNewFacility, bool) { + if o == nil || IsNil(o.Fra1) { + return nil, false + } + return o.Fra1, true +} + +// HasFra1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasFra1() bool { + if o != nil && !IsNil(o.Fra1) { + return true + } + + return false +} + +// SetFra1 gets a reference to the given SpotPricesPerNewFacility and assigns it to the Fra1 field. +func (o *SpotPricesReport) SetFra1(v SpotPricesPerNewFacility) { + o.Fra1 = &v +} + +// GetIad1 returns the Iad1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetIad1() SpotPricesPerNewFacility { + if o == nil || IsNil(o.Iad1) { + var ret SpotPricesPerNewFacility + return ret + } + return *o.Iad1 +} + +// GetIad1Ok returns a tuple with the Iad1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetIad1Ok() (*SpotPricesPerNewFacility, bool) { + if o == nil || IsNil(o.Iad1) { + return nil, false + } + return o.Iad1, true +} + +// HasIad1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasIad1() bool { + if o != nil && !IsNil(o.Iad1) { + return true + } + + return false +} + +// SetIad1 gets a reference to the given SpotPricesPerNewFacility and assigns it to the Iad1 field. +func (o *SpotPricesReport) SetIad1(v SpotPricesPerNewFacility) { + o.Iad1 = &v +} + +// GetLax1 returns the Lax1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetLax1() SpotPricesPerNewFacility { + if o == nil || IsNil(o.Lax1) { + var ret SpotPricesPerNewFacility + return ret + } + return *o.Lax1 +} + +// GetLax1Ok returns a tuple with the Lax1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetLax1Ok() (*SpotPricesPerNewFacility, bool) { + if o == nil || IsNil(o.Lax1) { + return nil, false + } + return o.Lax1, true +} + +// HasLax1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasLax1() bool { + if o != nil && !IsNil(o.Lax1) { + return true + } + + return false +} + +// SetLax1 gets a reference to the given SpotPricesPerNewFacility and assigns it to the Lax1 field. +func (o *SpotPricesReport) SetLax1(v SpotPricesPerNewFacility) { + o.Lax1 = &v +} + +// GetNrt1 returns the Nrt1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetNrt1() SpotPricesPerFacility { + if o == nil || IsNil(o.Nrt1) { + var ret SpotPricesPerFacility + return ret + } + return *o.Nrt1 +} + +// GetNrt1Ok returns a tuple with the Nrt1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetNrt1Ok() (*SpotPricesPerFacility, bool) { + if o == nil || IsNil(o.Nrt1) { + return nil, false + } + return o.Nrt1, true +} + +// HasNrt1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasNrt1() bool { + if o != nil && !IsNil(o.Nrt1) { + return true + } + + return false +} + +// SetNrt1 gets a reference to the given SpotPricesPerFacility and assigns it to the Nrt1 field. +func (o *SpotPricesReport) SetNrt1(v SpotPricesPerFacility) { + o.Nrt1 = &v +} + +// GetOrd1 returns the Ord1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetOrd1() SpotPricesPerNewFacility { + if o == nil || IsNil(o.Ord1) { + var ret SpotPricesPerNewFacility + return ret + } + return *o.Ord1 +} + +// GetOrd1Ok returns a tuple with the Ord1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetOrd1Ok() (*SpotPricesPerNewFacility, bool) { + if o == nil || IsNil(o.Ord1) { + return nil, false + } + return o.Ord1, true +} + +// HasOrd1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasOrd1() bool { + if o != nil && !IsNil(o.Ord1) { + return true + } + + return false +} + +// SetOrd1 gets a reference to the given SpotPricesPerNewFacility and assigns it to the Ord1 field. +func (o *SpotPricesReport) SetOrd1(v SpotPricesPerNewFacility) { + o.Ord1 = &v +} + +// GetSea1 returns the Sea1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetSea1() SpotPricesPerNewFacility { + if o == nil || IsNil(o.Sea1) { + var ret SpotPricesPerNewFacility + return ret + } + return *o.Sea1 +} + +// GetSea1Ok returns a tuple with the Sea1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetSea1Ok() (*SpotPricesPerNewFacility, bool) { + if o == nil || IsNil(o.Sea1) { + return nil, false + } + return o.Sea1, true +} + +// HasSea1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasSea1() bool { + if o != nil && !IsNil(o.Sea1) { + return true + } + + return false +} + +// SetSea1 gets a reference to the given SpotPricesPerNewFacility and assigns it to the Sea1 field. +func (o *SpotPricesReport) SetSea1(v SpotPricesPerNewFacility) { + o.Sea1 = &v +} + +// GetSin1 returns the Sin1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetSin1() SpotPricesPerNewFacility { + if o == nil || IsNil(o.Sin1) { + var ret SpotPricesPerNewFacility + return ret + } + return *o.Sin1 +} + +// GetSin1Ok returns a tuple with the Sin1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetSin1Ok() (*SpotPricesPerNewFacility, bool) { + if o == nil || IsNil(o.Sin1) { + return nil, false + } + return o.Sin1, true +} + +// HasSin1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasSin1() bool { + if o != nil && !IsNil(o.Sin1) { + return true + } + + return false +} + +// SetSin1 gets a reference to the given SpotPricesPerNewFacility and assigns it to the Sin1 field. +func (o *SpotPricesReport) SetSin1(v SpotPricesPerNewFacility) { + o.Sin1 = &v +} + +// GetSjc1 returns the Sjc1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetSjc1() SpotPricesPerFacility { + if o == nil || IsNil(o.Sjc1) { + var ret SpotPricesPerFacility + return ret + } + return *o.Sjc1 +} + +// GetSjc1Ok returns a tuple with the Sjc1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetSjc1Ok() (*SpotPricesPerFacility, bool) { + if o == nil || IsNil(o.Sjc1) { + return nil, false + } + return o.Sjc1, true +} + +// HasSjc1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasSjc1() bool { + if o != nil && !IsNil(o.Sjc1) { + return true + } + + return false +} + +// SetSjc1 gets a reference to the given SpotPricesPerFacility and assigns it to the Sjc1 field. +func (o *SpotPricesReport) SetSjc1(v SpotPricesPerFacility) { + o.Sjc1 = &v +} + +// GetSyd1 returns the Syd1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetSyd1() SpotPricesPerNewFacility { + if o == nil || IsNil(o.Syd1) { + var ret SpotPricesPerNewFacility + return ret + } + return *o.Syd1 +} + +// GetSyd1Ok returns a tuple with the Syd1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetSyd1Ok() (*SpotPricesPerNewFacility, bool) { + if o == nil || IsNil(o.Syd1) { + return nil, false + } + return o.Syd1, true +} + +// HasSyd1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasSyd1() bool { + if o != nil && !IsNil(o.Syd1) { + return true + } + + return false +} + +// SetSyd1 gets a reference to the given SpotPricesPerNewFacility and assigns it to the Syd1 field. +func (o *SpotPricesReport) SetSyd1(v SpotPricesPerNewFacility) { + o.Syd1 = &v +} + +// GetYyz1 returns the Yyz1 field value if set, zero value otherwise. +func (o *SpotPricesReport) GetYyz1() SpotPricesPerNewFacility { + if o == nil || IsNil(o.Yyz1) { + var ret SpotPricesPerNewFacility + return ret + } + return *o.Yyz1 +} + +// GetYyz1Ok returns a tuple with the Yyz1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SpotPricesReport) GetYyz1Ok() (*SpotPricesPerNewFacility, bool) { + if o == nil || IsNil(o.Yyz1) { + return nil, false + } + return o.Yyz1, true +} + +// HasYyz1 returns a boolean if a field has been set. +func (o *SpotPricesReport) HasYyz1() bool { + if o != nil && !IsNil(o.Yyz1) { + return true + } + + return false +} + +// SetYyz1 gets a reference to the given SpotPricesPerNewFacility and assigns it to the Yyz1 field. +func (o *SpotPricesReport) SetYyz1(v SpotPricesPerNewFacility) { + o.Yyz1 = &v +} + +func (o SpotPricesReport) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SpotPricesReport) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Ams1) { + toSerialize["ams1"] = o.Ams1 + } + if !IsNil(o.Atl1) { + toSerialize["atl1"] = o.Atl1 + } + if !IsNil(o.Dfw1) { + toSerialize["dfw1"] = o.Dfw1 + } + if !IsNil(o.Ewr1) { + toSerialize["ewr1"] = o.Ewr1 + } + if !IsNil(o.Fra1) { + toSerialize["fra1"] = o.Fra1 + } + if !IsNil(o.Iad1) { + toSerialize["iad1"] = o.Iad1 + } + if !IsNil(o.Lax1) { + toSerialize["lax1"] = o.Lax1 + } + if !IsNil(o.Nrt1) { + toSerialize["nrt1"] = o.Nrt1 + } + if !IsNil(o.Ord1) { + toSerialize["ord1"] = o.Ord1 + } + if !IsNil(o.Sea1) { + toSerialize["sea1"] = o.Sea1 + } + if !IsNil(o.Sin1) { + toSerialize["sin1"] = o.Sin1 + } + if !IsNil(o.Sjc1) { + toSerialize["sjc1"] = o.Sjc1 + } + if !IsNil(o.Syd1) { + toSerialize["syd1"] = o.Syd1 + } + if !IsNil(o.Yyz1) { + toSerialize["yyz1"] = o.Yyz1 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SpotPricesReport) UnmarshalJSON(data []byte) (err error) { + varSpotPricesReport := _SpotPricesReport{} + + err = json.Unmarshal(data, &varSpotPricesReport) + + if err != nil { + return err + } + + *o = SpotPricesReport(varSpotPricesReport) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ams1") + delete(additionalProperties, "atl1") + delete(additionalProperties, "dfw1") + delete(additionalProperties, "ewr1") + delete(additionalProperties, "fra1") + delete(additionalProperties, "iad1") + delete(additionalProperties, "lax1") + delete(additionalProperties, "nrt1") + delete(additionalProperties, "ord1") + delete(additionalProperties, "sea1") + delete(additionalProperties, "sin1") + delete(additionalProperties, "sjc1") + delete(additionalProperties, "syd1") + delete(additionalProperties, "yyz1") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSpotPricesReport struct { + value *SpotPricesReport + isSet bool +} + +func (v NullableSpotPricesReport) Get() *SpotPricesReport { + return v.value +} + +func (v *NullableSpotPricesReport) Set(val *SpotPricesReport) { + v.value = val + v.isSet = true +} + +func (v NullableSpotPricesReport) IsSet() bool { + return v.isSet +} + +func (v *NullableSpotPricesReport) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSpotPricesReport(val *SpotPricesReport) *NullableSpotPricesReport { + return &NullableSpotPricesReport{value: val, isSet: true} +} + +func (v NullableSpotPricesReport) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSpotPricesReport) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key.go new file mode 100644 index 00000000..50e3cdc1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key.go @@ -0,0 +1,451 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the SSHKey type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SSHKey{} + +// SSHKey struct for SSHKey +type SSHKey struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + Entity *Href `json:"entity,omitempty"` + Fingerprint *string `json:"fingerprint,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + Label *string `json:"label,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SSHKey SSHKey + +// NewSSHKey instantiates a new SSHKey object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSSHKey() *SSHKey { + this := SSHKey{} + return &this +} + +// NewSSHKeyWithDefaults instantiates a new SSHKey object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSSHKeyWithDefaults() *SSHKey { + this := SSHKey{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SSHKey) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKey) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *SSHKey) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *SSHKey) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetEntity returns the Entity field value if set, zero value otherwise. +func (o *SSHKey) GetEntity() Href { + if o == nil || IsNil(o.Entity) { + var ret Href + return ret + } + return *o.Entity +} + +// GetEntityOk returns a tuple with the Entity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKey) GetEntityOk() (*Href, bool) { + if o == nil || IsNil(o.Entity) { + return nil, false + } + return o.Entity, true +} + +// HasEntity returns a boolean if a field has been set. +func (o *SSHKey) HasEntity() bool { + if o != nil && !IsNil(o.Entity) { + return true + } + + return false +} + +// SetEntity gets a reference to the given Href and assigns it to the Entity field. +func (o *SSHKey) SetEntity(v Href) { + o.Entity = &v +} + +// GetFingerprint returns the Fingerprint field value if set, zero value otherwise. +func (o *SSHKey) GetFingerprint() string { + if o == nil || IsNil(o.Fingerprint) { + var ret string + return ret + } + return *o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKey) GetFingerprintOk() (*string, bool) { + if o == nil || IsNil(o.Fingerprint) { + return nil, false + } + return o.Fingerprint, true +} + +// HasFingerprint returns a boolean if a field has been set. +func (o *SSHKey) HasFingerprint() bool { + if o != nil && !IsNil(o.Fingerprint) { + return true + } + + return false +} + +// SetFingerprint gets a reference to the given string and assigns it to the Fingerprint field. +func (o *SSHKey) SetFingerprint(v string) { + o.Fingerprint = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *SSHKey) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKey) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *SSHKey) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *SSHKey) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SSHKey) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKey) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *SSHKey) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SSHKey) SetId(v string) { + o.Id = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *SSHKey) GetKey() string { + if o == nil || IsNil(o.Key) { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKey) GetKeyOk() (*string, bool) { + if o == nil || IsNil(o.Key) { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *SSHKey) HasKey() bool { + if o != nil && !IsNil(o.Key) { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *SSHKey) SetKey(v string) { + o.Key = &v +} + +// GetLabel returns the Label field value if set, zero value otherwise. +func (o *SSHKey) GetLabel() string { + if o == nil || IsNil(o.Label) { + var ret string + return ret + } + return *o.Label +} + +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKey) GetLabelOk() (*string, bool) { + if o == nil || IsNil(o.Label) { + return nil, false + } + return o.Label, true +} + +// HasLabel returns a boolean if a field has been set. +func (o *SSHKey) HasLabel() bool { + if o != nil && !IsNil(o.Label) { + return true + } + + return false +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. +func (o *SSHKey) SetLabel(v string) { + o.Label = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *SSHKey) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKey) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *SSHKey) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *SSHKey) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SSHKey) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKey) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *SSHKey) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SSHKey) SetTags(v []string) { + o.Tags = v +} + +func (o SSHKey) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SSHKey) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Entity) { + toSerialize["entity"] = o.Entity + } + if !IsNil(o.Fingerprint) { + toSerialize["fingerprint"] = o.Fingerprint + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Key) { + toSerialize["key"] = o.Key + } + if !IsNil(o.Label) { + toSerialize["label"] = o.Label + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SSHKey) UnmarshalJSON(data []byte) (err error) { + varSSHKey := _SSHKey{} + + err = json.Unmarshal(data, &varSSHKey) + + if err != nil { + return err + } + + *o = SSHKey(varSSHKey) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "entity") + delete(additionalProperties, "fingerprint") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "key") + delete(additionalProperties, "label") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSSHKey struct { + value *SSHKey + isSet bool +} + +func (v NullableSSHKey) Get() *SSHKey { + return v.value +} + +func (v *NullableSSHKey) Set(val *SSHKey) { + v.value = val + v.isSet = true +} + +func (v NullableSSHKey) IsSet() bool { + return v.isSet +} + +func (v *NullableSSHKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSSHKey(val *SSHKey) *NullableSSHKey { + return &NullableSSHKey{value: val, isSet: true} +} + +func (v NullableSSHKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSSHKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_create_input.go new file mode 100644 index 00000000..848d6387 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_create_input.go @@ -0,0 +1,266 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SSHKeyCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SSHKeyCreateInput{} + +// SSHKeyCreateInput struct for SSHKeyCreateInput +type SSHKeyCreateInput struct { + // List of instance UUIDs to associate SSH key with, when empty array is sent all instances belonging to entity will be included + InstancesIds []string `json:"instances_ids,omitempty"` + Key *string `json:"key,omitempty"` + Label *string `json:"label,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SSHKeyCreateInput SSHKeyCreateInput + +// NewSSHKeyCreateInput instantiates a new SSHKeyCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSSHKeyCreateInput() *SSHKeyCreateInput { + this := SSHKeyCreateInput{} + return &this +} + +// NewSSHKeyCreateInputWithDefaults instantiates a new SSHKeyCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSSHKeyCreateInputWithDefaults() *SSHKeyCreateInput { + this := SSHKeyCreateInput{} + return &this +} + +// GetInstancesIds returns the InstancesIds field value if set, zero value otherwise. +func (o *SSHKeyCreateInput) GetInstancesIds() []string { + if o == nil || IsNil(o.InstancesIds) { + var ret []string + return ret + } + return o.InstancesIds +} + +// GetInstancesIdsOk returns a tuple with the InstancesIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKeyCreateInput) GetInstancesIdsOk() ([]string, bool) { + if o == nil || IsNil(o.InstancesIds) { + return nil, false + } + return o.InstancesIds, true +} + +// HasInstancesIds returns a boolean if a field has been set. +func (o *SSHKeyCreateInput) HasInstancesIds() bool { + if o != nil && !IsNil(o.InstancesIds) { + return true + } + + return false +} + +// SetInstancesIds gets a reference to the given []string and assigns it to the InstancesIds field. +func (o *SSHKeyCreateInput) SetInstancesIds(v []string) { + o.InstancesIds = v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *SSHKeyCreateInput) GetKey() string { + if o == nil || IsNil(o.Key) { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKeyCreateInput) GetKeyOk() (*string, bool) { + if o == nil || IsNil(o.Key) { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *SSHKeyCreateInput) HasKey() bool { + if o != nil && !IsNil(o.Key) { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *SSHKeyCreateInput) SetKey(v string) { + o.Key = &v +} + +// GetLabel returns the Label field value if set, zero value otherwise. +func (o *SSHKeyCreateInput) GetLabel() string { + if o == nil || IsNil(o.Label) { + var ret string + return ret + } + return *o.Label +} + +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKeyCreateInput) GetLabelOk() (*string, bool) { + if o == nil || IsNil(o.Label) { + return nil, false + } + return o.Label, true +} + +// HasLabel returns a boolean if a field has been set. +func (o *SSHKeyCreateInput) HasLabel() bool { + if o != nil && !IsNil(o.Label) { + return true + } + + return false +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. +func (o *SSHKeyCreateInput) SetLabel(v string) { + o.Label = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SSHKeyCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKeyCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *SSHKeyCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SSHKeyCreateInput) SetTags(v []string) { + o.Tags = v +} + +func (o SSHKeyCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SSHKeyCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.InstancesIds) { + toSerialize["instances_ids"] = o.InstancesIds + } + if !IsNil(o.Key) { + toSerialize["key"] = o.Key + } + if !IsNil(o.Label) { + toSerialize["label"] = o.Label + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SSHKeyCreateInput) UnmarshalJSON(data []byte) (err error) { + varSSHKeyCreateInput := _SSHKeyCreateInput{} + + err = json.Unmarshal(data, &varSSHKeyCreateInput) + + if err != nil { + return err + } + + *o = SSHKeyCreateInput(varSSHKeyCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instances_ids") + delete(additionalProperties, "key") + delete(additionalProperties, "label") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSSHKeyCreateInput struct { + value *SSHKeyCreateInput + isSet bool +} + +func (v NullableSSHKeyCreateInput) Get() *SSHKeyCreateInput { + return v.value +} + +func (v *NullableSSHKeyCreateInput) Set(val *SSHKeyCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableSSHKeyCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableSSHKeyCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSSHKeyCreateInput(val *SSHKeyCreateInput) *NullableSSHKeyCreateInput { + return &NullableSSHKeyCreateInput{value: val, isSet: true} +} + +func (v NullableSSHKeyCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSSHKeyCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_input.go new file mode 100644 index 00000000..f4ddda4b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_input.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SSHKeyInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SSHKeyInput{} + +// SSHKeyInput struct for SSHKeyInput +type SSHKeyInput struct { + Key *string `json:"key,omitempty"` + Label *string `json:"label,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SSHKeyInput SSHKeyInput + +// NewSSHKeyInput instantiates a new SSHKeyInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSSHKeyInput() *SSHKeyInput { + this := SSHKeyInput{} + return &this +} + +// NewSSHKeyInputWithDefaults instantiates a new SSHKeyInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSSHKeyInputWithDefaults() *SSHKeyInput { + this := SSHKeyInput{} + return &this +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *SSHKeyInput) GetKey() string { + if o == nil || IsNil(o.Key) { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKeyInput) GetKeyOk() (*string, bool) { + if o == nil || IsNil(o.Key) { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *SSHKeyInput) HasKey() bool { + if o != nil && !IsNil(o.Key) { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *SSHKeyInput) SetKey(v string) { + o.Key = &v +} + +// GetLabel returns the Label field value if set, zero value otherwise. +func (o *SSHKeyInput) GetLabel() string { + if o == nil || IsNil(o.Label) { + var ret string + return ret + } + return *o.Label +} + +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKeyInput) GetLabelOk() (*string, bool) { + if o == nil || IsNil(o.Label) { + return nil, false + } + return o.Label, true +} + +// HasLabel returns a boolean if a field has been set. +func (o *SSHKeyInput) HasLabel() bool { + if o != nil && !IsNil(o.Label) { + return true + } + + return false +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. +func (o *SSHKeyInput) SetLabel(v string) { + o.Label = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SSHKeyInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKeyInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *SSHKeyInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SSHKeyInput) SetTags(v []string) { + o.Tags = v +} + +func (o SSHKeyInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SSHKeyInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Key) { + toSerialize["key"] = o.Key + } + if !IsNil(o.Label) { + toSerialize["label"] = o.Label + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SSHKeyInput) UnmarshalJSON(data []byte) (err error) { + varSSHKeyInput := _SSHKeyInput{} + + err = json.Unmarshal(data, &varSSHKeyInput) + + if err != nil { + return err + } + + *o = SSHKeyInput(varSSHKeyInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "key") + delete(additionalProperties, "label") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSSHKeyInput struct { + value *SSHKeyInput + isSet bool +} + +func (v NullableSSHKeyInput) Get() *SSHKeyInput { + return v.value +} + +func (v *NullableSSHKeyInput) Set(val *SSHKeyInput) { + v.value = val + v.isSet = true +} + +func (v NullableSSHKeyInput) IsSet() bool { + return v.isSet +} + +func (v *NullableSSHKeyInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSSHKeyInput(val *SSHKeyInput) *NullableSSHKeyInput { + return &NullableSSHKeyInput{value: val, isSet: true} +} + +func (v NullableSSHKeyInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSSHKeyInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_list.go new file mode 100644 index 00000000..2834108c --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_ssh_key_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the SSHKeyList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SSHKeyList{} + +// SSHKeyList struct for SSHKeyList +type SSHKeyList struct { + SshKeys []SSHKey `json:"ssh_keys,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SSHKeyList SSHKeyList + +// NewSSHKeyList instantiates a new SSHKeyList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSSHKeyList() *SSHKeyList { + this := SSHKeyList{} + return &this +} + +// NewSSHKeyListWithDefaults instantiates a new SSHKeyList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSSHKeyListWithDefaults() *SSHKeyList { + this := SSHKeyList{} + return &this +} + +// GetSshKeys returns the SshKeys field value if set, zero value otherwise. +func (o *SSHKeyList) GetSshKeys() []SSHKey { + if o == nil || IsNil(o.SshKeys) { + var ret []SSHKey + return ret + } + return o.SshKeys +} + +// GetSshKeysOk returns a tuple with the SshKeys field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SSHKeyList) GetSshKeysOk() ([]SSHKey, bool) { + if o == nil || IsNil(o.SshKeys) { + return nil, false + } + return o.SshKeys, true +} + +// HasSshKeys returns a boolean if a field has been set. +func (o *SSHKeyList) HasSshKeys() bool { + if o != nil && !IsNil(o.SshKeys) { + return true + } + + return false +} + +// SetSshKeys gets a reference to the given []SSHKey and assigns it to the SshKeys field. +func (o *SSHKeyList) SetSshKeys(v []SSHKey) { + o.SshKeys = v +} + +func (o SSHKeyList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SSHKeyList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.SshKeys) { + toSerialize["ssh_keys"] = o.SshKeys + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SSHKeyList) UnmarshalJSON(data []byte) (err error) { + varSSHKeyList := _SSHKeyList{} + + err = json.Unmarshal(data, &varSSHKeyList) + + if err != nil { + return err + } + + *o = SSHKeyList(varSSHKeyList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ssh_keys") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSSHKeyList struct { + value *SSHKeyList + isSet bool +} + +func (v NullableSSHKeyList) Get() *SSHKeyList { + return v.value +} + +func (v *NullableSSHKeyList) Set(val *SSHKeyList) { + v.value = val + v.isSet = true +} + +func (v NullableSSHKeyList) IsSet() bool { + return v.isSet +} + +func (v *NullableSSHKeyList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSSHKeyList(val *SSHKeyList) *NullableSSHKeyList { + return &NullableSSHKeyList{value: val, isSet: true} +} + +func (v NullableSSHKeyList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSSHKeyList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_storage.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_storage.go new file mode 100644 index 00000000..849ac14f --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_storage.go @@ -0,0 +1,228 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Storage type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Storage{} + +// Storage struct for Storage +type Storage struct { + Disks []Disk `json:"disks,omitempty"` + Raid []Raid `json:"raid,omitempty"` + Filesystems []Filesystem `json:"filesystems,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Storage Storage + +// NewStorage instantiates a new Storage object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewStorage() *Storage { + this := Storage{} + return &this +} + +// NewStorageWithDefaults instantiates a new Storage object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewStorageWithDefaults() *Storage { + this := Storage{} + return &this +} + +// GetDisks returns the Disks field value if set, zero value otherwise. +func (o *Storage) GetDisks() []Disk { + if o == nil || IsNil(o.Disks) { + var ret []Disk + return ret + } + return o.Disks +} + +// GetDisksOk returns a tuple with the Disks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Storage) GetDisksOk() ([]Disk, bool) { + if o == nil || IsNil(o.Disks) { + return nil, false + } + return o.Disks, true +} + +// HasDisks returns a boolean if a field has been set. +func (o *Storage) HasDisks() bool { + if o != nil && !IsNil(o.Disks) { + return true + } + + return false +} + +// SetDisks gets a reference to the given []Disk and assigns it to the Disks field. +func (o *Storage) SetDisks(v []Disk) { + o.Disks = v +} + +// GetRaid returns the Raid field value if set, zero value otherwise. +func (o *Storage) GetRaid() []Raid { + if o == nil || IsNil(o.Raid) { + var ret []Raid + return ret + } + return o.Raid +} + +// GetRaidOk returns a tuple with the Raid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Storage) GetRaidOk() ([]Raid, bool) { + if o == nil || IsNil(o.Raid) { + return nil, false + } + return o.Raid, true +} + +// HasRaid returns a boolean if a field has been set. +func (o *Storage) HasRaid() bool { + if o != nil && !IsNil(o.Raid) { + return true + } + + return false +} + +// SetRaid gets a reference to the given []Raid and assigns it to the Raid field. +func (o *Storage) SetRaid(v []Raid) { + o.Raid = v +} + +// GetFilesystems returns the Filesystems field value if set, zero value otherwise. +func (o *Storage) GetFilesystems() []Filesystem { + if o == nil || IsNil(o.Filesystems) { + var ret []Filesystem + return ret + } + return o.Filesystems +} + +// GetFilesystemsOk returns a tuple with the Filesystems field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Storage) GetFilesystemsOk() ([]Filesystem, bool) { + if o == nil || IsNil(o.Filesystems) { + return nil, false + } + return o.Filesystems, true +} + +// HasFilesystems returns a boolean if a field has been set. +func (o *Storage) HasFilesystems() bool { + if o != nil && !IsNil(o.Filesystems) { + return true + } + + return false +} + +// SetFilesystems gets a reference to the given []Filesystem and assigns it to the Filesystems field. +func (o *Storage) SetFilesystems(v []Filesystem) { + o.Filesystems = v +} + +func (o Storage) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Storage) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Disks) { + toSerialize["disks"] = o.Disks + } + if !IsNil(o.Raid) { + toSerialize["raid"] = o.Raid + } + if !IsNil(o.Filesystems) { + toSerialize["filesystems"] = o.Filesystems + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Storage) UnmarshalJSON(data []byte) (err error) { + varStorage := _Storage{} + + err = json.Unmarshal(data, &varStorage) + + if err != nil { + return err + } + + *o = Storage(varStorage) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "disks") + delete(additionalProperties, "raid") + delete(additionalProperties, "filesystems") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableStorage struct { + value *Storage + isSet bool +} + +func (v NullableStorage) Get() *Storage { + return v.value +} + +func (v *NullableStorage) Set(val *Storage) { + v.value = val + v.isSet = true +} + +func (v NullableStorage) IsSet() bool { + return v.isSet +} + +func (v *NullableStorage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorage(val *Storage) *NullableStorage { + return &NullableStorage{value: val, isSet: true} +} + +func (v NullableStorage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_support_request_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_support_request_input.go new file mode 100644 index 00000000..ea5688b1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_support_request_input.go @@ -0,0 +1,307 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the SupportRequestInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SupportRequestInput{} + +// SupportRequestInput struct for SupportRequestInput +type SupportRequestInput struct { + DeviceId *string `json:"device_id,omitempty"` + Message string `json:"message"` + Priority *SupportRequestInputPriority `json:"priority,omitempty"` + ProjectId *string `json:"project_id,omitempty"` + Subject string `json:"subject"` + AdditionalProperties map[string]interface{} +} + +type _SupportRequestInput SupportRequestInput + +// NewSupportRequestInput instantiates a new SupportRequestInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSupportRequestInput(message string, subject string) *SupportRequestInput { + this := SupportRequestInput{} + this.Message = message + this.Subject = subject + return &this +} + +// NewSupportRequestInputWithDefaults instantiates a new SupportRequestInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSupportRequestInputWithDefaults() *SupportRequestInput { + this := SupportRequestInput{} + return &this +} + +// GetDeviceId returns the DeviceId field value if set, zero value otherwise. +func (o *SupportRequestInput) GetDeviceId() string { + if o == nil || IsNil(o.DeviceId) { + var ret string + return ret + } + return *o.DeviceId +} + +// GetDeviceIdOk returns a tuple with the DeviceId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SupportRequestInput) GetDeviceIdOk() (*string, bool) { + if o == nil || IsNil(o.DeviceId) { + return nil, false + } + return o.DeviceId, true +} + +// HasDeviceId returns a boolean if a field has been set. +func (o *SupportRequestInput) HasDeviceId() bool { + if o != nil && !IsNil(o.DeviceId) { + return true + } + + return false +} + +// SetDeviceId gets a reference to the given string and assigns it to the DeviceId field. +func (o *SupportRequestInput) SetDeviceId(v string) { + o.DeviceId = &v +} + +// GetMessage returns the Message field value +func (o *SupportRequestInput) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *SupportRequestInput) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *SupportRequestInput) SetMessage(v string) { + o.Message = v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *SupportRequestInput) GetPriority() SupportRequestInputPriority { + if o == nil || IsNil(o.Priority) { + var ret SupportRequestInputPriority + return ret + } + return *o.Priority +} + +// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SupportRequestInput) GetPriorityOk() (*SupportRequestInputPriority, bool) { + if o == nil || IsNil(o.Priority) { + return nil, false + } + return o.Priority, true +} + +// HasPriority returns a boolean if a field has been set. +func (o *SupportRequestInput) HasPriority() bool { + if o != nil && !IsNil(o.Priority) { + return true + } + + return false +} + +// SetPriority gets a reference to the given SupportRequestInputPriority and assigns it to the Priority field. +func (o *SupportRequestInput) SetPriority(v SupportRequestInputPriority) { + o.Priority = &v +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *SupportRequestInput) GetProjectId() string { + if o == nil || IsNil(o.ProjectId) { + var ret string + return ret + } + return *o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SupportRequestInput) GetProjectIdOk() (*string, bool) { + if o == nil || IsNil(o.ProjectId) { + return nil, false + } + return o.ProjectId, true +} + +// HasProjectId returns a boolean if a field has been set. +func (o *SupportRequestInput) HasProjectId() bool { + if o != nil && !IsNil(o.ProjectId) { + return true + } + + return false +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *SupportRequestInput) SetProjectId(v string) { + o.ProjectId = &v +} + +// GetSubject returns the Subject field value +func (o *SupportRequestInput) GetSubject() string { + if o == nil { + var ret string + return ret + } + + return o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value +// and a boolean to check if the value has been set. +func (o *SupportRequestInput) GetSubjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subject, true +} + +// SetSubject sets field value +func (o *SupportRequestInput) SetSubject(v string) { + o.Subject = v +} + +func (o SupportRequestInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SupportRequestInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DeviceId) { + toSerialize["device_id"] = o.DeviceId + } + toSerialize["message"] = o.Message + if !IsNil(o.Priority) { + toSerialize["priority"] = o.Priority + } + if !IsNil(o.ProjectId) { + toSerialize["project_id"] = o.ProjectId + } + toSerialize["subject"] = o.Subject + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SupportRequestInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "message", + "subject", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSupportRequestInput := _SupportRequestInput{} + + err = json.Unmarshal(data, &varSupportRequestInput) + + if err != nil { + return err + } + + *o = SupportRequestInput(varSupportRequestInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "device_id") + delete(additionalProperties, "message") + delete(additionalProperties, "priority") + delete(additionalProperties, "project_id") + delete(additionalProperties, "subject") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSupportRequestInput struct { + value *SupportRequestInput + isSet bool +} + +func (v NullableSupportRequestInput) Get() *SupportRequestInput { + return v.value +} + +func (v *NullableSupportRequestInput) Set(val *SupportRequestInput) { + v.value = val + v.isSet = true +} + +func (v NullableSupportRequestInput) IsSet() bool { + return v.isSet +} + +func (v *NullableSupportRequestInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSupportRequestInput(val *SupportRequestInput) *NullableSupportRequestInput { + return &NullableSupportRequestInput{value: val, isSet: true} +} + +func (v NullableSupportRequestInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSupportRequestInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_support_request_input_priority.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_support_request_input_priority.go new file mode 100644 index 00000000..4ff33dfd --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_support_request_input_priority.go @@ -0,0 +1,115 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// SupportRequestInputPriority the model 'SupportRequestInputPriority' +type SupportRequestInputPriority string + +// List of SupportRequestInput_priority +const ( + SUPPORTREQUESTINPUTPRIORITY_URGENT SupportRequestInputPriority = "urgent" + SUPPORTREQUESTINPUTPRIORITY_HIGH SupportRequestInputPriority = "high" + SUPPORTREQUESTINPUTPRIORITY_MEDIUM SupportRequestInputPriority = "medium" + SUPPORTREQUESTINPUTPRIORITY_LOW SupportRequestInputPriority = "low" +) + +// All allowed values of SupportRequestInputPriority enum +var AllowedSupportRequestInputPriorityEnumValues = []SupportRequestInputPriority{ + "urgent", + "high", + "medium", + "low", +} + +func (v *SupportRequestInputPriority) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SupportRequestInputPriority(value) + for _, existing := range AllowedSupportRequestInputPriorityEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SupportRequestInputPriority", value) +} + +// NewSupportRequestInputPriorityFromValue returns a pointer to a valid SupportRequestInputPriority +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSupportRequestInputPriorityFromValue(v string) (*SupportRequestInputPriority, error) { + ev := SupportRequestInputPriority(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SupportRequestInputPriority: valid values are %v", v, AllowedSupportRequestInputPriorityEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SupportRequestInputPriority) IsValid() bool { + for _, existing := range AllowedSupportRequestInputPriorityEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SupportRequestInput_priority value +func (v SupportRequestInputPriority) Ptr() *SupportRequestInputPriority { + return &v +} + +type NullableSupportRequestInputPriority struct { + value *SupportRequestInputPriority + isSet bool +} + +func (v NullableSupportRequestInputPriority) Get() *SupportRequestInputPriority { + return v.value +} + +func (v *NullableSupportRequestInputPriority) Set(val *SupportRequestInputPriority) { + v.value = val + v.isSet = true +} + +func (v NullableSupportRequestInputPriority) IsSet() bool { + return v.isSet +} + +func (v *NullableSupportRequestInputPriority) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSupportRequestInputPriority(val *SupportRequestInputPriority) *NullableSupportRequestInputPriority { + return &NullableSupportRequestInputPriority{value: val, isSet: true} +} + +func (v NullableSupportRequestInputPriority) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSupportRequestInputPriority) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request.go new file mode 100644 index 00000000..0fb7ace4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request.go @@ -0,0 +1,340 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the TransferRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TransferRequest{} + +// TransferRequest struct for TransferRequest +type TransferRequest struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + Project *Href `json:"project,omitempty"` + TargetOrganization *Href `json:"target_organization,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TransferRequest TransferRequest + +// NewTransferRequest instantiates a new TransferRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTransferRequest() *TransferRequest { + this := TransferRequest{} + return &this +} + +// NewTransferRequestWithDefaults instantiates a new TransferRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTransferRequestWithDefaults() *TransferRequest { + this := TransferRequest{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *TransferRequest) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransferRequest) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *TransferRequest) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *TransferRequest) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *TransferRequest) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransferRequest) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *TransferRequest) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *TransferRequest) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *TransferRequest) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransferRequest) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *TransferRequest) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *TransferRequest) SetId(v string) { + o.Id = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *TransferRequest) GetProject() Href { + if o == nil || IsNil(o.Project) { + var ret Href + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransferRequest) GetProjectOk() (*Href, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *TransferRequest) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Href and assigns it to the Project field. +func (o *TransferRequest) SetProject(v Href) { + o.Project = &v +} + +// GetTargetOrganization returns the TargetOrganization field value if set, zero value otherwise. +func (o *TransferRequest) GetTargetOrganization() Href { + if o == nil || IsNil(o.TargetOrganization) { + var ret Href + return ret + } + return *o.TargetOrganization +} + +// GetTargetOrganizationOk returns a tuple with the TargetOrganization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransferRequest) GetTargetOrganizationOk() (*Href, bool) { + if o == nil || IsNil(o.TargetOrganization) { + return nil, false + } + return o.TargetOrganization, true +} + +// HasTargetOrganization returns a boolean if a field has been set. +func (o *TransferRequest) HasTargetOrganization() bool { + if o != nil && !IsNil(o.TargetOrganization) { + return true + } + + return false +} + +// SetTargetOrganization gets a reference to the given Href and assigns it to the TargetOrganization field. +func (o *TransferRequest) SetTargetOrganization(v Href) { + o.TargetOrganization = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *TransferRequest) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransferRequest) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *TransferRequest) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *TransferRequest) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o TransferRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TransferRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.TargetOrganization) { + toSerialize["target_organization"] = o.TargetOrganization + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TransferRequest) UnmarshalJSON(data []byte) (err error) { + varTransferRequest := _TransferRequest{} + + err = json.Unmarshal(data, &varTransferRequest) + + if err != nil { + return err + } + + *o = TransferRequest(varTransferRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "project") + delete(additionalProperties, "target_organization") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTransferRequest struct { + value *TransferRequest + isSet bool +} + +func (v NullableTransferRequest) Get() *TransferRequest { + return v.value +} + +func (v *NullableTransferRequest) Set(val *TransferRequest) { + v.value = val + v.isSet = true +} + +func (v NullableTransferRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableTransferRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTransferRequest(val *TransferRequest) *NullableTransferRequest { + return &NullableTransferRequest{value: val, isSet: true} +} + +func (v NullableTransferRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTransferRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request_input.go new file mode 100644 index 00000000..16ae195e --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request_input.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the TransferRequestInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TransferRequestInput{} + +// TransferRequestInput struct for TransferRequestInput +type TransferRequestInput struct { + TargetOrganizationId *string `json:"target_organization_id,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TransferRequestInput TransferRequestInput + +// NewTransferRequestInput instantiates a new TransferRequestInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTransferRequestInput() *TransferRequestInput { + this := TransferRequestInput{} + return &this +} + +// NewTransferRequestInputWithDefaults instantiates a new TransferRequestInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTransferRequestInputWithDefaults() *TransferRequestInput { + this := TransferRequestInput{} + return &this +} + +// GetTargetOrganizationId returns the TargetOrganizationId field value if set, zero value otherwise. +func (o *TransferRequestInput) GetTargetOrganizationId() string { + if o == nil || IsNil(o.TargetOrganizationId) { + var ret string + return ret + } + return *o.TargetOrganizationId +} + +// GetTargetOrganizationIdOk returns a tuple with the TargetOrganizationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransferRequestInput) GetTargetOrganizationIdOk() (*string, bool) { + if o == nil || IsNil(o.TargetOrganizationId) { + return nil, false + } + return o.TargetOrganizationId, true +} + +// HasTargetOrganizationId returns a boolean if a field has been set. +func (o *TransferRequestInput) HasTargetOrganizationId() bool { + if o != nil && !IsNil(o.TargetOrganizationId) { + return true + } + + return false +} + +// SetTargetOrganizationId gets a reference to the given string and assigns it to the TargetOrganizationId field. +func (o *TransferRequestInput) SetTargetOrganizationId(v string) { + o.TargetOrganizationId = &v +} + +func (o TransferRequestInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TransferRequestInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.TargetOrganizationId) { + toSerialize["target_organization_id"] = o.TargetOrganizationId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TransferRequestInput) UnmarshalJSON(data []byte) (err error) { + varTransferRequestInput := _TransferRequestInput{} + + err = json.Unmarshal(data, &varTransferRequestInput) + + if err != nil { + return err + } + + *o = TransferRequestInput(varTransferRequestInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "target_organization_id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTransferRequestInput struct { + value *TransferRequestInput + isSet bool +} + +func (v NullableTransferRequestInput) Get() *TransferRequestInput { + return v.value +} + +func (v *NullableTransferRequestInput) Set(val *TransferRequestInput) { + v.value = val + v.isSet = true +} + +func (v NullableTransferRequestInput) IsSet() bool { + return v.isSet +} + +func (v *NullableTransferRequestInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTransferRequestInput(val *TransferRequestInput) *NullableTransferRequestInput { + return &NullableTransferRequestInput{value: val, isSet: true} +} + +func (v NullableTransferRequestInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTransferRequestInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request_list.go new file mode 100644 index 00000000..1b202eb1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_transfer_request_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the TransferRequestList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TransferRequestList{} + +// TransferRequestList struct for TransferRequestList +type TransferRequestList struct { + Transfers []TransferRequest `json:"transfers,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TransferRequestList TransferRequestList + +// NewTransferRequestList instantiates a new TransferRequestList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTransferRequestList() *TransferRequestList { + this := TransferRequestList{} + return &this +} + +// NewTransferRequestListWithDefaults instantiates a new TransferRequestList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTransferRequestListWithDefaults() *TransferRequestList { + this := TransferRequestList{} + return &this +} + +// GetTransfers returns the Transfers field value if set, zero value otherwise. +func (o *TransferRequestList) GetTransfers() []TransferRequest { + if o == nil || IsNil(o.Transfers) { + var ret []TransferRequest + return ret + } + return o.Transfers +} + +// GetTransfersOk returns a tuple with the Transfers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransferRequestList) GetTransfersOk() ([]TransferRequest, bool) { + if o == nil || IsNil(o.Transfers) { + return nil, false + } + return o.Transfers, true +} + +// HasTransfers returns a boolean if a field has been set. +func (o *TransferRequestList) HasTransfers() bool { + if o != nil && !IsNil(o.Transfers) { + return true + } + + return false +} + +// SetTransfers gets a reference to the given []TransferRequest and assigns it to the Transfers field. +func (o *TransferRequestList) SetTransfers(v []TransferRequest) { + o.Transfers = v +} + +func (o TransferRequestList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TransferRequestList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Transfers) { + toSerialize["transfers"] = o.Transfers + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TransferRequestList) UnmarshalJSON(data []byte) (err error) { + varTransferRequestList := _TransferRequestList{} + + err = json.Unmarshal(data, &varTransferRequestList) + + if err != nil { + return err + } + + *o = TransferRequestList(varTransferRequestList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "transfers") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTransferRequestList struct { + value *TransferRequestList + isSet bool +} + +func (v NullableTransferRequestList) Get() *TransferRequestList { + return v.value +} + +func (v *NullableTransferRequestList) Set(val *TransferRequestList) { + v.value = val + v.isSet = true +} + +func (v NullableTransferRequestList) IsSet() bool { + return v.isSet +} + +func (v *NullableTransferRequestList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTransferRequestList(val *TransferRequestList) *NullableTransferRequestList { + return &NullableTransferRequestList{value: val, isSet: true} +} + +func (v NullableTransferRequestList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTransferRequestList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_update_email_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_update_email_input.go new file mode 100644 index 00000000..b9b3348a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_update_email_input.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the UpdateEmailInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateEmailInput{} + +// UpdateEmailInput struct for UpdateEmailInput +type UpdateEmailInput struct { + Default *bool `json:"default,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateEmailInput UpdateEmailInput + +// NewUpdateEmailInput instantiates a new UpdateEmailInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateEmailInput() *UpdateEmailInput { + this := UpdateEmailInput{} + return &this +} + +// NewUpdateEmailInputWithDefaults instantiates a new UpdateEmailInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateEmailInputWithDefaults() *UpdateEmailInput { + this := UpdateEmailInput{} + return &this +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *UpdateEmailInput) GetDefault() bool { + if o == nil || IsNil(o.Default) { + var ret bool + return ret + } + return *o.Default +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateEmailInput) GetDefaultOk() (*bool, bool) { + if o == nil || IsNil(o.Default) { + return nil, false + } + return o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *UpdateEmailInput) HasDefault() bool { + if o != nil && !IsNil(o.Default) { + return true + } + + return false +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *UpdateEmailInput) SetDefault(v bool) { + o.Default = &v +} + +func (o UpdateEmailInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateEmailInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Default) { + toSerialize["default"] = o.Default + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateEmailInput) UnmarshalJSON(data []byte) (err error) { + varUpdateEmailInput := _UpdateEmailInput{} + + err = json.Unmarshal(data, &varUpdateEmailInput) + + if err != nil { + return err + } + + *o = UpdateEmailInput(varUpdateEmailInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "default") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateEmailInput struct { + value *UpdateEmailInput + isSet bool +} + +func (v NullableUpdateEmailInput) Get() *UpdateEmailInput { + return v.value +} + +func (v *NullableUpdateEmailInput) Set(val *UpdateEmailInput) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateEmailInput) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateEmailInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateEmailInput(val *UpdateEmailInput) *NullableUpdateEmailInput { + return &NullableUpdateEmailInput{value: val, isSet: true} +} + +func (v NullableUpdateEmailInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateEmailInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user.go new file mode 100644 index 00000000..bbed326b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user.go @@ -0,0 +1,932 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the User type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &User{} + +// User struct for User +type User struct { + AvatarThumbUrl *string `json:"avatar_thumb_url,omitempty"` + AvatarUrl *string `json:"avatar_url,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + DefaultOrganizationId *string `json:"default_organization_id,omitempty"` + DefaultProjectId *string `json:"default_project_id,omitempty"` + Email *string `json:"email,omitempty"` + Emails []Href `json:"emails,omitempty"` + FirstName *string `json:"first_name,omitempty"` + FraudScore *string `json:"fraud_score,omitempty"` + FullName *string `json:"full_name,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + LastLoginAt *time.Time `json:"last_login_at,omitempty"` + LastName *string `json:"last_name,omitempty"` + MaxOrganizations *int32 `json:"max_organizations,omitempty"` + MaxProjects *int32 `json:"max_projects,omitempty"` + PhoneNumber *string `json:"phone_number,omitempty"` + ShortId *string `json:"short_id,omitempty"` + Timezone *string `json:"timezone,omitempty"` + TwoFactorAuth *string `json:"two_factor_auth,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _User User + +// NewUser instantiates a new User object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUser() *User { + this := User{} + return &this +} + +// NewUserWithDefaults instantiates a new User object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserWithDefaults() *User { + this := User{} + return &this +} + +// GetAvatarThumbUrl returns the AvatarThumbUrl field value if set, zero value otherwise. +func (o *User) GetAvatarThumbUrl() string { + if o == nil || IsNil(o.AvatarThumbUrl) { + var ret string + return ret + } + return *o.AvatarThumbUrl +} + +// GetAvatarThumbUrlOk returns a tuple with the AvatarThumbUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetAvatarThumbUrlOk() (*string, bool) { + if o == nil || IsNil(o.AvatarThumbUrl) { + return nil, false + } + return o.AvatarThumbUrl, true +} + +// HasAvatarThumbUrl returns a boolean if a field has been set. +func (o *User) HasAvatarThumbUrl() bool { + if o != nil && !IsNil(o.AvatarThumbUrl) { + return true + } + + return false +} + +// SetAvatarThumbUrl gets a reference to the given string and assigns it to the AvatarThumbUrl field. +func (o *User) SetAvatarThumbUrl(v string) { + o.AvatarThumbUrl = &v +} + +// GetAvatarUrl returns the AvatarUrl field value if set, zero value otherwise. +func (o *User) GetAvatarUrl() string { + if o == nil || IsNil(o.AvatarUrl) { + var ret string + return ret + } + return *o.AvatarUrl +} + +// GetAvatarUrlOk returns a tuple with the AvatarUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetAvatarUrlOk() (*string, bool) { + if o == nil || IsNil(o.AvatarUrl) { + return nil, false + } + return o.AvatarUrl, true +} + +// HasAvatarUrl returns a boolean if a field has been set. +func (o *User) HasAvatarUrl() bool { + if o != nil && !IsNil(o.AvatarUrl) { + return true + } + + return false +} + +// SetAvatarUrl gets a reference to the given string and assigns it to the AvatarUrl field. +func (o *User) SetAvatarUrl(v string) { + o.AvatarUrl = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *User) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *User) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *User) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *User) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *User) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *User) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDefaultOrganizationId returns the DefaultOrganizationId field value if set, zero value otherwise. +func (o *User) GetDefaultOrganizationId() string { + if o == nil || IsNil(o.DefaultOrganizationId) { + var ret string + return ret + } + return *o.DefaultOrganizationId +} + +// GetDefaultOrganizationIdOk returns a tuple with the DefaultOrganizationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetDefaultOrganizationIdOk() (*string, bool) { + if o == nil || IsNil(o.DefaultOrganizationId) { + return nil, false + } + return o.DefaultOrganizationId, true +} + +// HasDefaultOrganizationId returns a boolean if a field has been set. +func (o *User) HasDefaultOrganizationId() bool { + if o != nil && !IsNil(o.DefaultOrganizationId) { + return true + } + + return false +} + +// SetDefaultOrganizationId gets a reference to the given string and assigns it to the DefaultOrganizationId field. +func (o *User) SetDefaultOrganizationId(v string) { + o.DefaultOrganizationId = &v +} + +// GetDefaultProjectId returns the DefaultProjectId field value if set, zero value otherwise. +func (o *User) GetDefaultProjectId() string { + if o == nil || IsNil(o.DefaultProjectId) { + var ret string + return ret + } + return *o.DefaultProjectId +} + +// GetDefaultProjectIdOk returns a tuple with the DefaultProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetDefaultProjectIdOk() (*string, bool) { + if o == nil || IsNil(o.DefaultProjectId) { + return nil, false + } + return o.DefaultProjectId, true +} + +// HasDefaultProjectId returns a boolean if a field has been set. +func (o *User) HasDefaultProjectId() bool { + if o != nil && !IsNil(o.DefaultProjectId) { + return true + } + + return false +} + +// SetDefaultProjectId gets a reference to the given string and assigns it to the DefaultProjectId field. +func (o *User) SetDefaultProjectId(v string) { + o.DefaultProjectId = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *User) GetEmail() string { + if o == nil || IsNil(o.Email) { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetEmailOk() (*string, bool) { + if o == nil || IsNil(o.Email) { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *User) HasEmail() bool { + if o != nil && !IsNil(o.Email) { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *User) SetEmail(v string) { + o.Email = &v +} + +// GetEmails returns the Emails field value if set, zero value otherwise. +func (o *User) GetEmails() []Href { + if o == nil || IsNil(o.Emails) { + var ret []Href + return ret + } + return o.Emails +} + +// GetEmailsOk returns a tuple with the Emails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetEmailsOk() ([]Href, bool) { + if o == nil || IsNil(o.Emails) { + return nil, false + } + return o.Emails, true +} + +// HasEmails returns a boolean if a field has been set. +func (o *User) HasEmails() bool { + if o != nil && !IsNil(o.Emails) { + return true + } + + return false +} + +// SetEmails gets a reference to the given []Href and assigns it to the Emails field. +func (o *User) SetEmails(v []Href) { + o.Emails = v +} + +// GetFirstName returns the FirstName field value if set, zero value otherwise. +func (o *User) GetFirstName() string { + if o == nil || IsNil(o.FirstName) { + var ret string + return ret + } + return *o.FirstName +} + +// GetFirstNameOk returns a tuple with the FirstName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetFirstNameOk() (*string, bool) { + if o == nil || IsNil(o.FirstName) { + return nil, false + } + return o.FirstName, true +} + +// HasFirstName returns a boolean if a field has been set. +func (o *User) HasFirstName() bool { + if o != nil && !IsNil(o.FirstName) { + return true + } + + return false +} + +// SetFirstName gets a reference to the given string and assigns it to the FirstName field. +func (o *User) SetFirstName(v string) { + o.FirstName = &v +} + +// GetFraudScore returns the FraudScore field value if set, zero value otherwise. +func (o *User) GetFraudScore() string { + if o == nil || IsNil(o.FraudScore) { + var ret string + return ret + } + return *o.FraudScore +} + +// GetFraudScoreOk returns a tuple with the FraudScore field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetFraudScoreOk() (*string, bool) { + if o == nil || IsNil(o.FraudScore) { + return nil, false + } + return o.FraudScore, true +} + +// HasFraudScore returns a boolean if a field has been set. +func (o *User) HasFraudScore() bool { + if o != nil && !IsNil(o.FraudScore) { + return true + } + + return false +} + +// SetFraudScore gets a reference to the given string and assigns it to the FraudScore field. +func (o *User) SetFraudScore(v string) { + o.FraudScore = &v +} + +// GetFullName returns the FullName field value if set, zero value otherwise. +func (o *User) GetFullName() string { + if o == nil || IsNil(o.FullName) { + var ret string + return ret + } + return *o.FullName +} + +// GetFullNameOk returns a tuple with the FullName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetFullNameOk() (*string, bool) { + if o == nil || IsNil(o.FullName) { + return nil, false + } + return o.FullName, true +} + +// HasFullName returns a boolean if a field has been set. +func (o *User) HasFullName() bool { + if o != nil && !IsNil(o.FullName) { + return true + } + + return false +} + +// SetFullName gets a reference to the given string and assigns it to the FullName field. +func (o *User) SetFullName(v string) { + o.FullName = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *User) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *User) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *User) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *User) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *User) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *User) SetId(v string) { + o.Id = &v +} + +// GetLastLoginAt returns the LastLoginAt field value if set, zero value otherwise. +func (o *User) GetLastLoginAt() time.Time { + if o == nil || IsNil(o.LastLoginAt) { + var ret time.Time + return ret + } + return *o.LastLoginAt +} + +// GetLastLoginAtOk returns a tuple with the LastLoginAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetLastLoginAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.LastLoginAt) { + return nil, false + } + return o.LastLoginAt, true +} + +// HasLastLoginAt returns a boolean if a field has been set. +func (o *User) HasLastLoginAt() bool { + if o != nil && !IsNil(o.LastLoginAt) { + return true + } + + return false +} + +// SetLastLoginAt gets a reference to the given time.Time and assigns it to the LastLoginAt field. +func (o *User) SetLastLoginAt(v time.Time) { + o.LastLoginAt = &v +} + +// GetLastName returns the LastName field value if set, zero value otherwise. +func (o *User) GetLastName() string { + if o == nil || IsNil(o.LastName) { + var ret string + return ret + } + return *o.LastName +} + +// GetLastNameOk returns a tuple with the LastName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetLastNameOk() (*string, bool) { + if o == nil || IsNil(o.LastName) { + return nil, false + } + return o.LastName, true +} + +// HasLastName returns a boolean if a field has been set. +func (o *User) HasLastName() bool { + if o != nil && !IsNil(o.LastName) { + return true + } + + return false +} + +// SetLastName gets a reference to the given string and assigns it to the LastName field. +func (o *User) SetLastName(v string) { + o.LastName = &v +} + +// GetMaxOrganizations returns the MaxOrganizations field value if set, zero value otherwise. +func (o *User) GetMaxOrganizations() int32 { + if o == nil || IsNil(o.MaxOrganizations) { + var ret int32 + return ret + } + return *o.MaxOrganizations +} + +// GetMaxOrganizationsOk returns a tuple with the MaxOrganizations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetMaxOrganizationsOk() (*int32, bool) { + if o == nil || IsNil(o.MaxOrganizations) { + return nil, false + } + return o.MaxOrganizations, true +} + +// HasMaxOrganizations returns a boolean if a field has been set. +func (o *User) HasMaxOrganizations() bool { + if o != nil && !IsNil(o.MaxOrganizations) { + return true + } + + return false +} + +// SetMaxOrganizations gets a reference to the given int32 and assigns it to the MaxOrganizations field. +func (o *User) SetMaxOrganizations(v int32) { + o.MaxOrganizations = &v +} + +// GetMaxProjects returns the MaxProjects field value if set, zero value otherwise. +func (o *User) GetMaxProjects() int32 { + if o == nil || IsNil(o.MaxProjects) { + var ret int32 + return ret + } + return *o.MaxProjects +} + +// GetMaxProjectsOk returns a tuple with the MaxProjects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetMaxProjectsOk() (*int32, bool) { + if o == nil || IsNil(o.MaxProjects) { + return nil, false + } + return o.MaxProjects, true +} + +// HasMaxProjects returns a boolean if a field has been set. +func (o *User) HasMaxProjects() bool { + if o != nil && !IsNil(o.MaxProjects) { + return true + } + + return false +} + +// SetMaxProjects gets a reference to the given int32 and assigns it to the MaxProjects field. +func (o *User) SetMaxProjects(v int32) { + o.MaxProjects = &v +} + +// GetPhoneNumber returns the PhoneNumber field value if set, zero value otherwise. +func (o *User) GetPhoneNumber() string { + if o == nil || IsNil(o.PhoneNumber) { + var ret string + return ret + } + return *o.PhoneNumber +} + +// GetPhoneNumberOk returns a tuple with the PhoneNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetPhoneNumberOk() (*string, bool) { + if o == nil || IsNil(o.PhoneNumber) { + return nil, false + } + return o.PhoneNumber, true +} + +// HasPhoneNumber returns a boolean if a field has been set. +func (o *User) HasPhoneNumber() bool { + if o != nil && !IsNil(o.PhoneNumber) { + return true + } + + return false +} + +// SetPhoneNumber gets a reference to the given string and assigns it to the PhoneNumber field. +func (o *User) SetPhoneNumber(v string) { + o.PhoneNumber = &v +} + +// GetShortId returns the ShortId field value if set, zero value otherwise. +func (o *User) GetShortId() string { + if o == nil || IsNil(o.ShortId) { + var ret string + return ret + } + return *o.ShortId +} + +// GetShortIdOk returns a tuple with the ShortId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetShortIdOk() (*string, bool) { + if o == nil || IsNil(o.ShortId) { + return nil, false + } + return o.ShortId, true +} + +// HasShortId returns a boolean if a field has been set. +func (o *User) HasShortId() bool { + if o != nil && !IsNil(o.ShortId) { + return true + } + + return false +} + +// SetShortId gets a reference to the given string and assigns it to the ShortId field. +func (o *User) SetShortId(v string) { + o.ShortId = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *User) GetTimezone() string { + if o == nil || IsNil(o.Timezone) { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetTimezoneOk() (*string, bool) { + if o == nil || IsNil(o.Timezone) { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *User) HasTimezone() bool { + if o != nil && !IsNil(o.Timezone) { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *User) SetTimezone(v string) { + o.Timezone = &v +} + +// GetTwoFactorAuth returns the TwoFactorAuth field value if set, zero value otherwise. +func (o *User) GetTwoFactorAuth() string { + if o == nil || IsNil(o.TwoFactorAuth) { + var ret string + return ret + } + return *o.TwoFactorAuth +} + +// GetTwoFactorAuthOk returns a tuple with the TwoFactorAuth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetTwoFactorAuthOk() (*string, bool) { + if o == nil || IsNil(o.TwoFactorAuth) { + return nil, false + } + return o.TwoFactorAuth, true +} + +// HasTwoFactorAuth returns a boolean if a field has been set. +func (o *User) HasTwoFactorAuth() bool { + if o != nil && !IsNil(o.TwoFactorAuth) { + return true + } + + return false +} + +// SetTwoFactorAuth gets a reference to the given string and assigns it to the TwoFactorAuth field. +func (o *User) SetTwoFactorAuth(v string) { + o.TwoFactorAuth = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *User) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *User) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *User) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *User) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o User) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o User) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AvatarThumbUrl) { + toSerialize["avatar_thumb_url"] = o.AvatarThumbUrl + } + if !IsNil(o.AvatarUrl) { + toSerialize["avatar_url"] = o.AvatarUrl + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.DefaultOrganizationId) { + toSerialize["default_organization_id"] = o.DefaultOrganizationId + } + if !IsNil(o.DefaultProjectId) { + toSerialize["default_project_id"] = o.DefaultProjectId + } + if !IsNil(o.Email) { + toSerialize["email"] = o.Email + } + if !IsNil(o.Emails) { + toSerialize["emails"] = o.Emails + } + if !IsNil(o.FirstName) { + toSerialize["first_name"] = o.FirstName + } + if !IsNil(o.FraudScore) { + toSerialize["fraud_score"] = o.FraudScore + } + if !IsNil(o.FullName) { + toSerialize["full_name"] = o.FullName + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.LastLoginAt) { + toSerialize["last_login_at"] = o.LastLoginAt + } + if !IsNil(o.LastName) { + toSerialize["last_name"] = o.LastName + } + if !IsNil(o.MaxOrganizations) { + toSerialize["max_organizations"] = o.MaxOrganizations + } + if !IsNil(o.MaxProjects) { + toSerialize["max_projects"] = o.MaxProjects + } + if !IsNil(o.PhoneNumber) { + toSerialize["phone_number"] = o.PhoneNumber + } + if !IsNil(o.ShortId) { + toSerialize["short_id"] = o.ShortId + } + if !IsNil(o.Timezone) { + toSerialize["timezone"] = o.Timezone + } + if !IsNil(o.TwoFactorAuth) { + toSerialize["two_factor_auth"] = o.TwoFactorAuth + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *User) UnmarshalJSON(data []byte) (err error) { + varUser := _User{} + + err = json.Unmarshal(data, &varUser) + + if err != nil { + return err + } + + *o = User(varUser) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "avatar_thumb_url") + delete(additionalProperties, "avatar_url") + delete(additionalProperties, "created_at") + delete(additionalProperties, "customdata") + delete(additionalProperties, "default_organization_id") + delete(additionalProperties, "default_project_id") + delete(additionalProperties, "email") + delete(additionalProperties, "emails") + delete(additionalProperties, "first_name") + delete(additionalProperties, "fraud_score") + delete(additionalProperties, "full_name") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "last_login_at") + delete(additionalProperties, "last_name") + delete(additionalProperties, "max_organizations") + delete(additionalProperties, "max_projects") + delete(additionalProperties, "phone_number") + delete(additionalProperties, "short_id") + delete(additionalProperties, "timezone") + delete(additionalProperties, "two_factor_auth") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUser struct { + value *User + isSet bool +} + +func (v NullableUser) Get() *User { + return v.value +} + +func (v *NullableUser) Set(val *User) { + v.value = val + v.isSet = true +} + +func (v NullableUser) IsSet() bool { + return v.isSet +} + +func (v *NullableUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUser(val *User) *NullableUser { + return &NullableUser{value: val, isSet: true} +} + +func (v NullableUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_create_input.go new file mode 100644 index 00000000..9235d9d0 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_create_input.go @@ -0,0 +1,745 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "os" + "time" +) + +// checks if the UserCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserCreateInput{} + +// UserCreateInput struct for UserCreateInput +type UserCreateInput struct { + Avatar **os.File `json:"avatar,omitempty"` + CompanyName *string `json:"company_name,omitempty"` + CompanyUrl *string `json:"company_url,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Emails []EmailInput `json:"emails"` + FirstName string `json:"first_name"` + LastName string `json:"last_name"` + Level *string `json:"level,omitempty"` + Password *string `json:"password,omitempty"` + PhoneNumber *string `json:"phone_number,omitempty"` + SocialAccounts map[string]interface{} `json:"social_accounts,omitempty"` + Timezone *string `json:"timezone,omitempty"` + Title *string `json:"title,omitempty"` + TwoFactorAuth *string `json:"two_factor_auth,omitempty"` + VerifiedAt *time.Time `json:"verified_at,omitempty"` + InvitationId *string `json:"invitation_id,omitempty"` + Nonce *string `json:"nonce,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UserCreateInput UserCreateInput + +// NewUserCreateInput instantiates a new UserCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserCreateInput(emails []EmailInput, firstName string, lastName string) *UserCreateInput { + this := UserCreateInput{} + this.Emails = emails + this.FirstName = firstName + this.LastName = lastName + return &this +} + +// NewUserCreateInputWithDefaults instantiates a new UserCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserCreateInputWithDefaults() *UserCreateInput { + this := UserCreateInput{} + return &this +} + +// GetAvatar returns the Avatar field value if set, zero value otherwise. +func (o *UserCreateInput) GetAvatar() *os.File { + if o == nil || IsNil(o.Avatar) { + var ret *os.File + return ret + } + return *o.Avatar +} + +// GetAvatarOk returns a tuple with the Avatar field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetAvatarOk() (**os.File, bool) { + if o == nil || IsNil(o.Avatar) { + return nil, false + } + return o.Avatar, true +} + +// HasAvatar returns a boolean if a field has been set. +func (o *UserCreateInput) HasAvatar() bool { + if o != nil && !IsNil(o.Avatar) { + return true + } + + return false +} + +// SetAvatar gets a reference to the given *os.File and assigns it to the Avatar field. +func (o *UserCreateInput) SetAvatar(v *os.File) { + o.Avatar = &v +} + +// GetCompanyName returns the CompanyName field value if set, zero value otherwise. +func (o *UserCreateInput) GetCompanyName() string { + if o == nil || IsNil(o.CompanyName) { + var ret string + return ret + } + return *o.CompanyName +} + +// GetCompanyNameOk returns a tuple with the CompanyName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetCompanyNameOk() (*string, bool) { + if o == nil || IsNil(o.CompanyName) { + return nil, false + } + return o.CompanyName, true +} + +// HasCompanyName returns a boolean if a field has been set. +func (o *UserCreateInput) HasCompanyName() bool { + if o != nil && !IsNil(o.CompanyName) { + return true + } + + return false +} + +// SetCompanyName gets a reference to the given string and assigns it to the CompanyName field. +func (o *UserCreateInput) SetCompanyName(v string) { + o.CompanyName = &v +} + +// GetCompanyUrl returns the CompanyUrl field value if set, zero value otherwise. +func (o *UserCreateInput) GetCompanyUrl() string { + if o == nil || IsNil(o.CompanyUrl) { + var ret string + return ret + } + return *o.CompanyUrl +} + +// GetCompanyUrlOk returns a tuple with the CompanyUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetCompanyUrlOk() (*string, bool) { + if o == nil || IsNil(o.CompanyUrl) { + return nil, false + } + return o.CompanyUrl, true +} + +// HasCompanyUrl returns a boolean if a field has been set. +func (o *UserCreateInput) HasCompanyUrl() bool { + if o != nil && !IsNil(o.CompanyUrl) { + return true + } + + return false +} + +// SetCompanyUrl gets a reference to the given string and assigns it to the CompanyUrl field. +func (o *UserCreateInput) SetCompanyUrl(v string) { + o.CompanyUrl = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *UserCreateInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *UserCreateInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *UserCreateInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetEmails returns the Emails field value +func (o *UserCreateInput) GetEmails() []EmailInput { + if o == nil { + var ret []EmailInput + return ret + } + + return o.Emails +} + +// GetEmailsOk returns a tuple with the Emails field value +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetEmailsOk() ([]EmailInput, bool) { + if o == nil { + return nil, false + } + return o.Emails, true +} + +// SetEmails sets field value +func (o *UserCreateInput) SetEmails(v []EmailInput) { + o.Emails = v +} + +// GetFirstName returns the FirstName field value +func (o *UserCreateInput) GetFirstName() string { + if o == nil { + var ret string + return ret + } + + return o.FirstName +} + +// GetFirstNameOk returns a tuple with the FirstName field value +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetFirstNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FirstName, true +} + +// SetFirstName sets field value +func (o *UserCreateInput) SetFirstName(v string) { + o.FirstName = v +} + +// GetLastName returns the LastName field value +func (o *UserCreateInput) GetLastName() string { + if o == nil { + var ret string + return ret + } + + return o.LastName +} + +// GetLastNameOk returns a tuple with the LastName field value +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetLastNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.LastName, true +} + +// SetLastName sets field value +func (o *UserCreateInput) SetLastName(v string) { + o.LastName = v +} + +// GetLevel returns the Level field value if set, zero value otherwise. +func (o *UserCreateInput) GetLevel() string { + if o == nil || IsNil(o.Level) { + var ret string + return ret + } + return *o.Level +} + +// GetLevelOk returns a tuple with the Level field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetLevelOk() (*string, bool) { + if o == nil || IsNil(o.Level) { + return nil, false + } + return o.Level, true +} + +// HasLevel returns a boolean if a field has been set. +func (o *UserCreateInput) HasLevel() bool { + if o != nil && !IsNil(o.Level) { + return true + } + + return false +} + +// SetLevel gets a reference to the given string and assigns it to the Level field. +func (o *UserCreateInput) SetLevel(v string) { + o.Level = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *UserCreateInput) GetPassword() string { + if o == nil || IsNil(o.Password) { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetPasswordOk() (*string, bool) { + if o == nil || IsNil(o.Password) { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *UserCreateInput) HasPassword() bool { + if o != nil && !IsNil(o.Password) { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *UserCreateInput) SetPassword(v string) { + o.Password = &v +} + +// GetPhoneNumber returns the PhoneNumber field value if set, zero value otherwise. +func (o *UserCreateInput) GetPhoneNumber() string { + if o == nil || IsNil(o.PhoneNumber) { + var ret string + return ret + } + return *o.PhoneNumber +} + +// GetPhoneNumberOk returns a tuple with the PhoneNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetPhoneNumberOk() (*string, bool) { + if o == nil || IsNil(o.PhoneNumber) { + return nil, false + } + return o.PhoneNumber, true +} + +// HasPhoneNumber returns a boolean if a field has been set. +func (o *UserCreateInput) HasPhoneNumber() bool { + if o != nil && !IsNil(o.PhoneNumber) { + return true + } + + return false +} + +// SetPhoneNumber gets a reference to the given string and assigns it to the PhoneNumber field. +func (o *UserCreateInput) SetPhoneNumber(v string) { + o.PhoneNumber = &v +} + +// GetSocialAccounts returns the SocialAccounts field value if set, zero value otherwise. +func (o *UserCreateInput) GetSocialAccounts() map[string]interface{} { + if o == nil || IsNil(o.SocialAccounts) { + var ret map[string]interface{} + return ret + } + return o.SocialAccounts +} + +// GetSocialAccountsOk returns a tuple with the SocialAccounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetSocialAccountsOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.SocialAccounts) { + return map[string]interface{}{}, false + } + return o.SocialAccounts, true +} + +// HasSocialAccounts returns a boolean if a field has been set. +func (o *UserCreateInput) HasSocialAccounts() bool { + if o != nil && !IsNil(o.SocialAccounts) { + return true + } + + return false +} + +// SetSocialAccounts gets a reference to the given map[string]interface{} and assigns it to the SocialAccounts field. +func (o *UserCreateInput) SetSocialAccounts(v map[string]interface{}) { + o.SocialAccounts = v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *UserCreateInput) GetTimezone() string { + if o == nil || IsNil(o.Timezone) { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetTimezoneOk() (*string, bool) { + if o == nil || IsNil(o.Timezone) { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *UserCreateInput) HasTimezone() bool { + if o != nil && !IsNil(o.Timezone) { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *UserCreateInput) SetTimezone(v string) { + o.Timezone = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *UserCreateInput) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetTitleOk() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *UserCreateInput) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *UserCreateInput) SetTitle(v string) { + o.Title = &v +} + +// GetTwoFactorAuth returns the TwoFactorAuth field value if set, zero value otherwise. +func (o *UserCreateInput) GetTwoFactorAuth() string { + if o == nil || IsNil(o.TwoFactorAuth) { + var ret string + return ret + } + return *o.TwoFactorAuth +} + +// GetTwoFactorAuthOk returns a tuple with the TwoFactorAuth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetTwoFactorAuthOk() (*string, bool) { + if o == nil || IsNil(o.TwoFactorAuth) { + return nil, false + } + return o.TwoFactorAuth, true +} + +// HasTwoFactorAuth returns a boolean if a field has been set. +func (o *UserCreateInput) HasTwoFactorAuth() bool { + if o != nil && !IsNil(o.TwoFactorAuth) { + return true + } + + return false +} + +// SetTwoFactorAuth gets a reference to the given string and assigns it to the TwoFactorAuth field. +func (o *UserCreateInput) SetTwoFactorAuth(v string) { + o.TwoFactorAuth = &v +} + +// GetVerifiedAt returns the VerifiedAt field value if set, zero value otherwise. +func (o *UserCreateInput) GetVerifiedAt() time.Time { + if o == nil || IsNil(o.VerifiedAt) { + var ret time.Time + return ret + } + return *o.VerifiedAt +} + +// GetVerifiedAtOk returns a tuple with the VerifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetVerifiedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.VerifiedAt) { + return nil, false + } + return o.VerifiedAt, true +} + +// HasVerifiedAt returns a boolean if a field has been set. +func (o *UserCreateInput) HasVerifiedAt() bool { + if o != nil && !IsNil(o.VerifiedAt) { + return true + } + + return false +} + +// SetVerifiedAt gets a reference to the given time.Time and assigns it to the VerifiedAt field. +func (o *UserCreateInput) SetVerifiedAt(v time.Time) { + o.VerifiedAt = &v +} + +// GetInvitationId returns the InvitationId field value if set, zero value otherwise. +func (o *UserCreateInput) GetInvitationId() string { + if o == nil || IsNil(o.InvitationId) { + var ret string + return ret + } + return *o.InvitationId +} + +// GetInvitationIdOk returns a tuple with the InvitationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetInvitationIdOk() (*string, bool) { + if o == nil || IsNil(o.InvitationId) { + return nil, false + } + return o.InvitationId, true +} + +// HasInvitationId returns a boolean if a field has been set. +func (o *UserCreateInput) HasInvitationId() bool { + if o != nil && !IsNil(o.InvitationId) { + return true + } + + return false +} + +// SetInvitationId gets a reference to the given string and assigns it to the InvitationId field. +func (o *UserCreateInput) SetInvitationId(v string) { + o.InvitationId = &v +} + +// GetNonce returns the Nonce field value if set, zero value otherwise. +func (o *UserCreateInput) GetNonce() string { + if o == nil || IsNil(o.Nonce) { + var ret string + return ret + } + return *o.Nonce +} + +// GetNonceOk returns a tuple with the Nonce field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateInput) GetNonceOk() (*string, bool) { + if o == nil || IsNil(o.Nonce) { + return nil, false + } + return o.Nonce, true +} + +// HasNonce returns a boolean if a field has been set. +func (o *UserCreateInput) HasNonce() bool { + if o != nil && !IsNil(o.Nonce) { + return true + } + + return false +} + +// SetNonce gets a reference to the given string and assigns it to the Nonce field. +func (o *UserCreateInput) SetNonce(v string) { + o.Nonce = &v +} + +func (o UserCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UserCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Avatar) { + toSerialize["avatar"] = o.Avatar + } + if !IsNil(o.CompanyName) { + toSerialize["company_name"] = o.CompanyName + } + if !IsNil(o.CompanyUrl) { + toSerialize["company_url"] = o.CompanyUrl + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + toSerialize["emails"] = o.Emails + toSerialize["first_name"] = o.FirstName + toSerialize["last_name"] = o.LastName + if !IsNil(o.Level) { + toSerialize["level"] = o.Level + } + if !IsNil(o.Password) { + toSerialize["password"] = o.Password + } + if !IsNil(o.PhoneNumber) { + toSerialize["phone_number"] = o.PhoneNumber + } + if !IsNil(o.SocialAccounts) { + toSerialize["social_accounts"] = o.SocialAccounts + } + if !IsNil(o.Timezone) { + toSerialize["timezone"] = o.Timezone + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + if !IsNil(o.TwoFactorAuth) { + toSerialize["two_factor_auth"] = o.TwoFactorAuth + } + if !IsNil(o.VerifiedAt) { + toSerialize["verified_at"] = o.VerifiedAt + } + if !IsNil(o.InvitationId) { + toSerialize["invitation_id"] = o.InvitationId + } + if !IsNil(o.Nonce) { + toSerialize["nonce"] = o.Nonce + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UserCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "emails", + "first_name", + "last_name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUserCreateInput := _UserCreateInput{} + + err = json.Unmarshal(data, &varUserCreateInput) + + if err != nil { + return err + } + + *o = UserCreateInput(varUserCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "avatar") + delete(additionalProperties, "company_name") + delete(additionalProperties, "company_url") + delete(additionalProperties, "customdata") + delete(additionalProperties, "emails") + delete(additionalProperties, "first_name") + delete(additionalProperties, "last_name") + delete(additionalProperties, "level") + delete(additionalProperties, "password") + delete(additionalProperties, "phone_number") + delete(additionalProperties, "social_accounts") + delete(additionalProperties, "timezone") + delete(additionalProperties, "title") + delete(additionalProperties, "two_factor_auth") + delete(additionalProperties, "verified_at") + delete(additionalProperties, "invitation_id") + delete(additionalProperties, "nonce") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUserCreateInput struct { + value *UserCreateInput + isSet bool +} + +func (v NullableUserCreateInput) Get() *UserCreateInput { + return v.value +} + +func (v *NullableUserCreateInput) Set(val *UserCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableUserCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableUserCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserCreateInput(val *UserCreateInput) *NullableUserCreateInput { + return &NullableUserCreateInput{value: val, isSet: true} +} + +func (v NullableUserCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_limited.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_limited.go new file mode 100644 index 00000000..aa4e909b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_limited.go @@ -0,0 +1,320 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the UserLimited type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserLimited{} + +// UserLimited struct for UserLimited +type UserLimited struct { + // Avatar thumbnail URL of the User + AvatarThumbUrl *string `json:"avatar_thumb_url,omitempty"` + // Avatar URL of the User + AvatarUrl *string `json:"avatar_url,omitempty"` + // Full name of the User + FullName *string `json:"full_name,omitempty"` + // API URL uniquely representing the User + Href *string `json:"href,omitempty"` + // ID of the User + Id string `json:"id"` + AdditionalProperties map[string]interface{} +} + +type _UserLimited UserLimited + +// NewUserLimited instantiates a new UserLimited object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserLimited(id string) *UserLimited { + this := UserLimited{} + this.Id = id + return &this +} + +// NewUserLimitedWithDefaults instantiates a new UserLimited object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserLimitedWithDefaults() *UserLimited { + this := UserLimited{} + return &this +} + +// GetAvatarThumbUrl returns the AvatarThumbUrl field value if set, zero value otherwise. +func (o *UserLimited) GetAvatarThumbUrl() string { + if o == nil || IsNil(o.AvatarThumbUrl) { + var ret string + return ret + } + return *o.AvatarThumbUrl +} + +// GetAvatarThumbUrlOk returns a tuple with the AvatarThumbUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLimited) GetAvatarThumbUrlOk() (*string, bool) { + if o == nil || IsNil(o.AvatarThumbUrl) { + return nil, false + } + return o.AvatarThumbUrl, true +} + +// HasAvatarThumbUrl returns a boolean if a field has been set. +func (o *UserLimited) HasAvatarThumbUrl() bool { + if o != nil && !IsNil(o.AvatarThumbUrl) { + return true + } + + return false +} + +// SetAvatarThumbUrl gets a reference to the given string and assigns it to the AvatarThumbUrl field. +func (o *UserLimited) SetAvatarThumbUrl(v string) { + o.AvatarThumbUrl = &v +} + +// GetAvatarUrl returns the AvatarUrl field value if set, zero value otherwise. +func (o *UserLimited) GetAvatarUrl() string { + if o == nil || IsNil(o.AvatarUrl) { + var ret string + return ret + } + return *o.AvatarUrl +} + +// GetAvatarUrlOk returns a tuple with the AvatarUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLimited) GetAvatarUrlOk() (*string, bool) { + if o == nil || IsNil(o.AvatarUrl) { + return nil, false + } + return o.AvatarUrl, true +} + +// HasAvatarUrl returns a boolean if a field has been set. +func (o *UserLimited) HasAvatarUrl() bool { + if o != nil && !IsNil(o.AvatarUrl) { + return true + } + + return false +} + +// SetAvatarUrl gets a reference to the given string and assigns it to the AvatarUrl field. +func (o *UserLimited) SetAvatarUrl(v string) { + o.AvatarUrl = &v +} + +// GetFullName returns the FullName field value if set, zero value otherwise. +func (o *UserLimited) GetFullName() string { + if o == nil || IsNil(o.FullName) { + var ret string + return ret + } + return *o.FullName +} + +// GetFullNameOk returns a tuple with the FullName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLimited) GetFullNameOk() (*string, bool) { + if o == nil || IsNil(o.FullName) { + return nil, false + } + return o.FullName, true +} + +// HasFullName returns a boolean if a field has been set. +func (o *UserLimited) HasFullName() bool { + if o != nil && !IsNil(o.FullName) { + return true + } + + return false +} + +// SetFullName gets a reference to the given string and assigns it to the FullName field. +func (o *UserLimited) SetFullName(v string) { + o.FullName = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *UserLimited) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLimited) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *UserLimited) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *UserLimited) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value +func (o *UserLimited) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *UserLimited) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *UserLimited) SetId(v string) { + o.Id = v +} + +func (o UserLimited) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UserLimited) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AvatarThumbUrl) { + toSerialize["avatar_thumb_url"] = o.AvatarThumbUrl + } + if !IsNil(o.AvatarUrl) { + toSerialize["avatar_url"] = o.AvatarUrl + } + if !IsNil(o.FullName) { + toSerialize["full_name"] = o.FullName + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + toSerialize["id"] = o.Id + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UserLimited) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUserLimited := _UserLimited{} + + err = json.Unmarshal(data, &varUserLimited) + + if err != nil { + return err + } + + *o = UserLimited(varUserLimited) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "avatar_thumb_url") + delete(additionalProperties, "avatar_url") + delete(additionalProperties, "full_name") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUserLimited struct { + value *UserLimited + isSet bool +} + +func (v NullableUserLimited) Get() *UserLimited { + return v.value +} + +func (v *NullableUserLimited) Set(val *UserLimited) { + v.value = val + v.isSet = true +} + +func (v NullableUserLimited) IsSet() bool { + return v.isSet +} + +func (v *NullableUserLimited) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserLimited(val *UserLimited) *NullableUserLimited { + return &NullableUserLimited{value: val, isSet: true} +} + +func (v NullableUserLimited) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserLimited) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_list.go new file mode 100644 index 00000000..ebd501d9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_list.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the UserList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserList{} + +// UserList struct for UserList +type UserList struct { + Meta *Meta `json:"meta,omitempty"` + Users []User `json:"users,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UserList UserList + +// NewUserList instantiates a new UserList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserList() *UserList { + this := UserList{} + return &this +} + +// NewUserListWithDefaults instantiates a new UserList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserListWithDefaults() *UserList { + this := UserList{} + return &this +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *UserList) GetMeta() Meta { + if o == nil || IsNil(o.Meta) { + var ret Meta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserList) GetMetaOk() (*Meta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *UserList) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given Meta and assigns it to the Meta field. +func (o *UserList) SetMeta(v Meta) { + o.Meta = &v +} + +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *UserList) GetUsers() []User { + if o == nil || IsNil(o.Users) { + var ret []User + return ret + } + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserList) GetUsersOk() ([]User, bool) { + if o == nil || IsNil(o.Users) { + return nil, false + } + return o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *UserList) HasUsers() bool { + if o != nil && !IsNil(o.Users) { + return true + } + + return false +} + +// SetUsers gets a reference to the given []User and assigns it to the Users field. +func (o *UserList) SetUsers(v []User) { + o.Users = v +} + +func (o UserList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UserList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + if !IsNil(o.Users) { + toSerialize["users"] = o.Users + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UserList) UnmarshalJSON(data []byte) (err error) { + varUserList := _UserList{} + + err = json.Unmarshal(data, &varUserList) + + if err != nil { + return err + } + + *o = UserList(varUserList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "meta") + delete(additionalProperties, "users") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUserList struct { + value *UserList + isSet bool +} + +func (v NullableUserList) Get() *UserList { + return v.value +} + +func (v *NullableUserList) Set(val *UserList) { + v.value = val + v.isSet = true +} + +func (v NullableUserList) IsSet() bool { + return v.isSet +} + +func (v *NullableUserList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserList(val *UserList) *NullableUserList { + return &NullableUserList{value: val, isSet: true} +} + +func (v NullableUserList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_lite.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_lite.go new file mode 100644 index 00000000..0063fe72 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_lite.go @@ -0,0 +1,503 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the UserLite type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserLite{} + +// UserLite struct for UserLite +type UserLite struct { + // Avatar thumbnail URL of the User + AvatarThumbUrl *string `json:"avatar_thumb_url,omitempty"` + // When the user was created + CreatedAt *time.Time `json:"created_at,omitempty"` + // Primary email address of the User + Email *string `json:"email,omitempty"` + // First name of the User + FirstName *string `json:"first_name,omitempty"` + // Full name of the User + FullName *string `json:"full_name,omitempty"` + // API URL uniquely representing the User + Href *string `json:"href,omitempty"` + // ID of the User + Id string `json:"id"` + // Last name of the User + LastName *string `json:"last_name,omitempty"` + // Short ID of the User + ShortId string `json:"short_id"` + // When the user details were last updated + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UserLite UserLite + +// NewUserLite instantiates a new UserLite object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserLite(id string, shortId string) *UserLite { + this := UserLite{} + this.Id = id + this.ShortId = shortId + return &this +} + +// NewUserLiteWithDefaults instantiates a new UserLite object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserLiteWithDefaults() *UserLite { + this := UserLite{} + return &this +} + +// GetAvatarThumbUrl returns the AvatarThumbUrl field value if set, zero value otherwise. +func (o *UserLite) GetAvatarThumbUrl() string { + if o == nil || IsNil(o.AvatarThumbUrl) { + var ret string + return ret + } + return *o.AvatarThumbUrl +} + +// GetAvatarThumbUrlOk returns a tuple with the AvatarThumbUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLite) GetAvatarThumbUrlOk() (*string, bool) { + if o == nil || IsNil(o.AvatarThumbUrl) { + return nil, false + } + return o.AvatarThumbUrl, true +} + +// HasAvatarThumbUrl returns a boolean if a field has been set. +func (o *UserLite) HasAvatarThumbUrl() bool { + if o != nil && !IsNil(o.AvatarThumbUrl) { + return true + } + + return false +} + +// SetAvatarThumbUrl gets a reference to the given string and assigns it to the AvatarThumbUrl field. +func (o *UserLite) SetAvatarThumbUrl(v string) { + o.AvatarThumbUrl = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UserLite) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLite) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UserLite) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *UserLite) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *UserLite) GetEmail() string { + if o == nil || IsNil(o.Email) { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLite) GetEmailOk() (*string, bool) { + if o == nil || IsNil(o.Email) { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *UserLite) HasEmail() bool { + if o != nil && !IsNil(o.Email) { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *UserLite) SetEmail(v string) { + o.Email = &v +} + +// GetFirstName returns the FirstName field value if set, zero value otherwise. +func (o *UserLite) GetFirstName() string { + if o == nil || IsNil(o.FirstName) { + var ret string + return ret + } + return *o.FirstName +} + +// GetFirstNameOk returns a tuple with the FirstName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLite) GetFirstNameOk() (*string, bool) { + if o == nil || IsNil(o.FirstName) { + return nil, false + } + return o.FirstName, true +} + +// HasFirstName returns a boolean if a field has been set. +func (o *UserLite) HasFirstName() bool { + if o != nil && !IsNil(o.FirstName) { + return true + } + + return false +} + +// SetFirstName gets a reference to the given string and assigns it to the FirstName field. +func (o *UserLite) SetFirstName(v string) { + o.FirstName = &v +} + +// GetFullName returns the FullName field value if set, zero value otherwise. +func (o *UserLite) GetFullName() string { + if o == nil || IsNil(o.FullName) { + var ret string + return ret + } + return *o.FullName +} + +// GetFullNameOk returns a tuple with the FullName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLite) GetFullNameOk() (*string, bool) { + if o == nil || IsNil(o.FullName) { + return nil, false + } + return o.FullName, true +} + +// HasFullName returns a boolean if a field has been set. +func (o *UserLite) HasFullName() bool { + if o != nil && !IsNil(o.FullName) { + return true + } + + return false +} + +// SetFullName gets a reference to the given string and assigns it to the FullName field. +func (o *UserLite) SetFullName(v string) { + o.FullName = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *UserLite) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLite) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *UserLite) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *UserLite) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value +func (o *UserLite) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *UserLite) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *UserLite) SetId(v string) { + o.Id = v +} + +// GetLastName returns the LastName field value if set, zero value otherwise. +func (o *UserLite) GetLastName() string { + if o == nil || IsNil(o.LastName) { + var ret string + return ret + } + return *o.LastName +} + +// GetLastNameOk returns a tuple with the LastName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLite) GetLastNameOk() (*string, bool) { + if o == nil || IsNil(o.LastName) { + return nil, false + } + return o.LastName, true +} + +// HasLastName returns a boolean if a field has been set. +func (o *UserLite) HasLastName() bool { + if o != nil && !IsNil(o.LastName) { + return true + } + + return false +} + +// SetLastName gets a reference to the given string and assigns it to the LastName field. +func (o *UserLite) SetLastName(v string) { + o.LastName = &v +} + +// GetShortId returns the ShortId field value +func (o *UserLite) GetShortId() string { + if o == nil { + var ret string + return ret + } + + return o.ShortId +} + +// GetShortIdOk returns a tuple with the ShortId field value +// and a boolean to check if the value has been set. +func (o *UserLite) GetShortIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ShortId, true +} + +// SetShortId sets field value +func (o *UserLite) SetShortId(v string) { + o.ShortId = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *UserLite) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserLite) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *UserLite) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *UserLite) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o UserLite) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UserLite) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AvatarThumbUrl) { + toSerialize["avatar_thumb_url"] = o.AvatarThumbUrl + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Email) { + toSerialize["email"] = o.Email + } + if !IsNil(o.FirstName) { + toSerialize["first_name"] = o.FirstName + } + if !IsNil(o.FullName) { + toSerialize["full_name"] = o.FullName + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + toSerialize["id"] = o.Id + if !IsNil(o.LastName) { + toSerialize["last_name"] = o.LastName + } + toSerialize["short_id"] = o.ShortId + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UserLite) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "short_id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUserLite := _UserLite{} + + err = json.Unmarshal(data, &varUserLite) + + if err != nil { + return err + } + + *o = UserLite(varUserLite) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "avatar_thumb_url") + delete(additionalProperties, "created_at") + delete(additionalProperties, "email") + delete(additionalProperties, "first_name") + delete(additionalProperties, "full_name") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "last_name") + delete(additionalProperties, "short_id") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUserLite struct { + value *UserLite + isSet bool +} + +func (v NullableUserLite) Get() *UserLite { + return v.value +} + +func (v *NullableUserLite) Set(val *UserLite) { + v.value = val + v.isSet = true +} + +func (v NullableUserLite) IsSet() bool { + return v.isSet +} + +func (v *NullableUserLite) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserLite(val *UserLite) *NullableUserLite { + return &NullableUserLite{value: val, isSet: true} +} + +func (v NullableUserLite) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserLite) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_update_input.go new file mode 100644 index 00000000..c7b50afc --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_user_update_input.go @@ -0,0 +1,339 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the UserUpdateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserUpdateInput{} + +// UserUpdateInput struct for UserUpdateInput +type UserUpdateInput struct { + Customdata map[string]interface{} `json:"customdata,omitempty"` + FirstName *string `json:"first_name,omitempty"` + LastName *string `json:"last_name,omitempty"` + Password *string `json:"password,omitempty"` + PhoneNumber *string `json:"phone_number,omitempty"` + Timezone *string `json:"timezone,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UserUpdateInput UserUpdateInput + +// NewUserUpdateInput instantiates a new UserUpdateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserUpdateInput() *UserUpdateInput { + this := UserUpdateInput{} + return &this +} + +// NewUserUpdateInputWithDefaults instantiates a new UserUpdateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserUpdateInputWithDefaults() *UserUpdateInput { + this := UserUpdateInput{} + return &this +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *UserUpdateInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *UserUpdateInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *UserUpdateInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetFirstName returns the FirstName field value if set, zero value otherwise. +func (o *UserUpdateInput) GetFirstName() string { + if o == nil || IsNil(o.FirstName) { + var ret string + return ret + } + return *o.FirstName +} + +// GetFirstNameOk returns a tuple with the FirstName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateInput) GetFirstNameOk() (*string, bool) { + if o == nil || IsNil(o.FirstName) { + return nil, false + } + return o.FirstName, true +} + +// HasFirstName returns a boolean if a field has been set. +func (o *UserUpdateInput) HasFirstName() bool { + if o != nil && !IsNil(o.FirstName) { + return true + } + + return false +} + +// SetFirstName gets a reference to the given string and assigns it to the FirstName field. +func (o *UserUpdateInput) SetFirstName(v string) { + o.FirstName = &v +} + +// GetLastName returns the LastName field value if set, zero value otherwise. +func (o *UserUpdateInput) GetLastName() string { + if o == nil || IsNil(o.LastName) { + var ret string + return ret + } + return *o.LastName +} + +// GetLastNameOk returns a tuple with the LastName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateInput) GetLastNameOk() (*string, bool) { + if o == nil || IsNil(o.LastName) { + return nil, false + } + return o.LastName, true +} + +// HasLastName returns a boolean if a field has been set. +func (o *UserUpdateInput) HasLastName() bool { + if o != nil && !IsNil(o.LastName) { + return true + } + + return false +} + +// SetLastName gets a reference to the given string and assigns it to the LastName field. +func (o *UserUpdateInput) SetLastName(v string) { + o.LastName = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *UserUpdateInput) GetPassword() string { + if o == nil || IsNil(o.Password) { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateInput) GetPasswordOk() (*string, bool) { + if o == nil || IsNil(o.Password) { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *UserUpdateInput) HasPassword() bool { + if o != nil && !IsNil(o.Password) { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *UserUpdateInput) SetPassword(v string) { + o.Password = &v +} + +// GetPhoneNumber returns the PhoneNumber field value if set, zero value otherwise. +func (o *UserUpdateInput) GetPhoneNumber() string { + if o == nil || IsNil(o.PhoneNumber) { + var ret string + return ret + } + return *o.PhoneNumber +} + +// GetPhoneNumberOk returns a tuple with the PhoneNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateInput) GetPhoneNumberOk() (*string, bool) { + if o == nil || IsNil(o.PhoneNumber) { + return nil, false + } + return o.PhoneNumber, true +} + +// HasPhoneNumber returns a boolean if a field has been set. +func (o *UserUpdateInput) HasPhoneNumber() bool { + if o != nil && !IsNil(o.PhoneNumber) { + return true + } + + return false +} + +// SetPhoneNumber gets a reference to the given string and assigns it to the PhoneNumber field. +func (o *UserUpdateInput) SetPhoneNumber(v string) { + o.PhoneNumber = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *UserUpdateInput) GetTimezone() string { + if o == nil || IsNil(o.Timezone) { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateInput) GetTimezoneOk() (*string, bool) { + if o == nil || IsNil(o.Timezone) { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *UserUpdateInput) HasTimezone() bool { + if o != nil && !IsNil(o.Timezone) { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *UserUpdateInput) SetTimezone(v string) { + o.Timezone = &v +} + +func (o UserUpdateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UserUpdateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.FirstName) { + toSerialize["first_name"] = o.FirstName + } + if !IsNil(o.LastName) { + toSerialize["last_name"] = o.LastName + } + if !IsNil(o.Password) { + toSerialize["password"] = o.Password + } + if !IsNil(o.PhoneNumber) { + toSerialize["phone_number"] = o.PhoneNumber + } + if !IsNil(o.Timezone) { + toSerialize["timezone"] = o.Timezone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UserUpdateInput) UnmarshalJSON(data []byte) (err error) { + varUserUpdateInput := _UserUpdateInput{} + + err = json.Unmarshal(data, &varUserUpdateInput) + + if err != nil { + return err + } + + *o = UserUpdateInput(varUserUpdateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "customdata") + delete(additionalProperties, "first_name") + delete(additionalProperties, "last_name") + delete(additionalProperties, "password") + delete(additionalProperties, "phone_number") + delete(additionalProperties, "timezone") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUserUpdateInput struct { + value *UserUpdateInput + isSet bool +} + +func (v NullableUserUpdateInput) Get() *UserUpdateInput { + return v.value +} + +func (v *NullableUserUpdateInput) Set(val *UserUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullableUserUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableUserUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserUpdateInput(val *UserUpdateInput) *NullableUserUpdateInput { + return &NullableUserUpdateInput{value: val, isSet: true} +} + +func (v NullableUserUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_userdata.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_userdata.go new file mode 100644 index 00000000..13d1bf58 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_userdata.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the Userdata type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Userdata{} + +// Userdata struct for Userdata +type Userdata struct { + Userdata *string `json:"userdata,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Userdata Userdata + +// NewUserdata instantiates a new Userdata object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUserdata() *Userdata { + this := Userdata{} + return &this +} + +// NewUserdataWithDefaults instantiates a new Userdata object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserdataWithDefaults() *Userdata { + this := Userdata{} + return &this +} + +// GetUserdata returns the Userdata field value if set, zero value otherwise. +func (o *Userdata) GetUserdata() string { + if o == nil || IsNil(o.Userdata) { + var ret string + return ret + } + return *o.Userdata +} + +// GetUserdataOk returns a tuple with the Userdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Userdata) GetUserdataOk() (*string, bool) { + if o == nil || IsNil(o.Userdata) { + return nil, false + } + return o.Userdata, true +} + +// HasUserdata returns a boolean if a field has been set. +func (o *Userdata) HasUserdata() bool { + if o != nil && !IsNil(o.Userdata) { + return true + } + + return false +} + +// SetUserdata gets a reference to the given string and assigns it to the Userdata field. +func (o *Userdata) SetUserdata(v string) { + o.Userdata = &v +} + +func (o Userdata) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Userdata) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Userdata) { + toSerialize["userdata"] = o.Userdata + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Userdata) UnmarshalJSON(data []byte) (err error) { + varUserdata := _Userdata{} + + err = json.Unmarshal(data, &varUserdata) + + if err != nil { + return err + } + + *o = Userdata(varUserdata) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "userdata") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUserdata struct { + value *Userdata + isSet bool +} + +func (v NullableUserdata) Get() *Userdata { + return v.value +} + +func (v *NullableUserdata) Set(val *Userdata) { + v.value = val + v.isSet = true +} + +func (v NullableUserdata) IsSet() bool { + return v.isSet +} + +func (v *NullableUserdata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserdata(val *Userdata) *NullableUserdata { + return &NullableUserdata{value: val, isSet: true} +} + +func (v NullableUserdata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserdata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_verify_email.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_verify_email.go new file mode 100644 index 00000000..fa906457 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_verify_email.go @@ -0,0 +1,168 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the VerifyEmail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VerifyEmail{} + +// VerifyEmail struct for VerifyEmail +type VerifyEmail struct { + // User verification token + UserToken string `json:"user_token"` + AdditionalProperties map[string]interface{} +} + +type _VerifyEmail VerifyEmail + +// NewVerifyEmail instantiates a new VerifyEmail object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVerifyEmail(userToken string) *VerifyEmail { + this := VerifyEmail{} + this.UserToken = userToken + return &this +} + +// NewVerifyEmailWithDefaults instantiates a new VerifyEmail object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVerifyEmailWithDefaults() *VerifyEmail { + this := VerifyEmail{} + return &this +} + +// GetUserToken returns the UserToken field value +func (o *VerifyEmail) GetUserToken() string { + if o == nil { + var ret string + return ret + } + + return o.UserToken +} + +// GetUserTokenOk returns a tuple with the UserToken field value +// and a boolean to check if the value has been set. +func (o *VerifyEmail) GetUserTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.UserToken, true +} + +// SetUserToken sets field value +func (o *VerifyEmail) SetUserToken(v string) { + o.UserToken = v +} + +func (o VerifyEmail) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VerifyEmail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["user_token"] = o.UserToken + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VerifyEmail) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "user_token", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVerifyEmail := _VerifyEmail{} + + err = json.Unmarshal(data, &varVerifyEmail) + + if err != nil { + return err + } + + *o = VerifyEmail(varVerifyEmail) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "user_token") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVerifyEmail struct { + value *VerifyEmail + isSet bool +} + +func (v NullableVerifyEmail) Get() *VerifyEmail { + return v.value +} + +func (v *NullableVerifyEmail) Set(val *VerifyEmail) { + v.value = val + v.isSet = true +} + +func (v NullableVerifyEmail) IsSet() bool { + return v.isSet +} + +func (v *NullableVerifyEmail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVerifyEmail(val *VerifyEmail) *NullableVerifyEmail { + return &NullableVerifyEmail{value: val, isSet: true} +} + +func (v NullableVerifyEmail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVerifyEmail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit.go new file mode 100644 index 00000000..da0bbdca --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit.go @@ -0,0 +1,146 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VirtualCircuit - struct for VirtualCircuit +type VirtualCircuit struct { + VlanVirtualCircuit *VlanVirtualCircuit + VrfVirtualCircuit *VrfVirtualCircuit +} + +// VlanVirtualCircuitAsVirtualCircuit is a convenience function that returns VlanVirtualCircuit wrapped in VirtualCircuit +func VlanVirtualCircuitAsVirtualCircuit(v *VlanVirtualCircuit) VirtualCircuit { + return VirtualCircuit{ + VlanVirtualCircuit: v, + } +} + +// VrfVirtualCircuitAsVirtualCircuit is a convenience function that returns VrfVirtualCircuit wrapped in VirtualCircuit +func VrfVirtualCircuitAsVirtualCircuit(v *VrfVirtualCircuit) VirtualCircuit { + return VirtualCircuit{ + VrfVirtualCircuit: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *VirtualCircuit) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into VlanVirtualCircuit + err = newStrictDecoder(data).Decode(&dst.VlanVirtualCircuit) + if err == nil { + jsonVlanVirtualCircuit, _ := json.Marshal(dst.VlanVirtualCircuit) + if string(jsonVlanVirtualCircuit) == "{}" { // empty struct + dst.VlanVirtualCircuit = nil + } else { + match++ + } + } else { + dst.VlanVirtualCircuit = nil + } + + // try to unmarshal data into VrfVirtualCircuit + err = newStrictDecoder(data).Decode(&dst.VrfVirtualCircuit) + if err == nil { + jsonVrfVirtualCircuit, _ := json.Marshal(dst.VrfVirtualCircuit) + if string(jsonVrfVirtualCircuit) == "{}" { // empty struct + dst.VrfVirtualCircuit = nil + } else { + match++ + } + } else { + dst.VrfVirtualCircuit = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.VlanVirtualCircuit = nil + dst.VrfVirtualCircuit = nil + + return fmt.Errorf("data matches more than one schema in oneOf(VirtualCircuit)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(VirtualCircuit)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src VirtualCircuit) MarshalJSON() ([]byte, error) { + if src.VlanVirtualCircuit != nil { + return json.Marshal(&src.VlanVirtualCircuit) + } + + if src.VrfVirtualCircuit != nil { + return json.Marshal(&src.VrfVirtualCircuit) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *VirtualCircuit) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.VlanVirtualCircuit != nil { + return obj.VlanVirtualCircuit + } + + if obj.VrfVirtualCircuit != nil { + return obj.VrfVirtualCircuit + } + + // all schemas are nil + return nil +} + +type NullableVirtualCircuit struct { + value *VirtualCircuit + isSet bool +} + +func (v NullableVirtualCircuit) Get() *VirtualCircuit { + return v.value +} + +func (v *NullableVirtualCircuit) Set(val *VirtualCircuit) { + v.value = val + v.isSet = true +} + +func (v NullableVirtualCircuit) IsSet() bool { + return v.isSet +} + +func (v *NullableVirtualCircuit) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVirtualCircuit(val *VirtualCircuit) *NullableVirtualCircuit { + return &NullableVirtualCircuit{value: val, isSet: true} +} + +func (v NullableVirtualCircuit) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVirtualCircuit) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_create_input.go new file mode 100644 index 00000000..3accc34a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_create_input.go @@ -0,0 +1,146 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VirtualCircuitCreateInput - struct for VirtualCircuitCreateInput +type VirtualCircuitCreateInput struct { + VlanVirtualCircuitCreateInput *VlanVirtualCircuitCreateInput + VrfVirtualCircuitCreateInput *VrfVirtualCircuitCreateInput +} + +// VlanVirtualCircuitCreateInputAsVirtualCircuitCreateInput is a convenience function that returns VlanVirtualCircuitCreateInput wrapped in VirtualCircuitCreateInput +func VlanVirtualCircuitCreateInputAsVirtualCircuitCreateInput(v *VlanVirtualCircuitCreateInput) VirtualCircuitCreateInput { + return VirtualCircuitCreateInput{ + VlanVirtualCircuitCreateInput: v, + } +} + +// VrfVirtualCircuitCreateInputAsVirtualCircuitCreateInput is a convenience function that returns VrfVirtualCircuitCreateInput wrapped in VirtualCircuitCreateInput +func VrfVirtualCircuitCreateInputAsVirtualCircuitCreateInput(v *VrfVirtualCircuitCreateInput) VirtualCircuitCreateInput { + return VirtualCircuitCreateInput{ + VrfVirtualCircuitCreateInput: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *VirtualCircuitCreateInput) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into VlanVirtualCircuitCreateInput + err = newStrictDecoder(data).Decode(&dst.VlanVirtualCircuitCreateInput) + if err == nil { + jsonVlanVirtualCircuitCreateInput, _ := json.Marshal(dst.VlanVirtualCircuitCreateInput) + if string(jsonVlanVirtualCircuitCreateInput) == "{}" { // empty struct + dst.VlanVirtualCircuitCreateInput = nil + } else { + match++ + } + } else { + dst.VlanVirtualCircuitCreateInput = nil + } + + // try to unmarshal data into VrfVirtualCircuitCreateInput + err = newStrictDecoder(data).Decode(&dst.VrfVirtualCircuitCreateInput) + if err == nil { + jsonVrfVirtualCircuitCreateInput, _ := json.Marshal(dst.VrfVirtualCircuitCreateInput) + if string(jsonVrfVirtualCircuitCreateInput) == "{}" { // empty struct + dst.VrfVirtualCircuitCreateInput = nil + } else { + match++ + } + } else { + dst.VrfVirtualCircuitCreateInput = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.VlanVirtualCircuitCreateInput = nil + dst.VrfVirtualCircuitCreateInput = nil + + return fmt.Errorf("data matches more than one schema in oneOf(VirtualCircuitCreateInput)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(VirtualCircuitCreateInput)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src VirtualCircuitCreateInput) MarshalJSON() ([]byte, error) { + if src.VlanVirtualCircuitCreateInput != nil { + return json.Marshal(&src.VlanVirtualCircuitCreateInput) + } + + if src.VrfVirtualCircuitCreateInput != nil { + return json.Marshal(&src.VrfVirtualCircuitCreateInput) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *VirtualCircuitCreateInput) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.VlanVirtualCircuitCreateInput != nil { + return obj.VlanVirtualCircuitCreateInput + } + + if obj.VrfVirtualCircuitCreateInput != nil { + return obj.VrfVirtualCircuitCreateInput + } + + // all schemas are nil + return nil +} + +type NullableVirtualCircuitCreateInput struct { + value *VirtualCircuitCreateInput + isSet bool +} + +func (v NullableVirtualCircuitCreateInput) Get() *VirtualCircuitCreateInput { + return v.value +} + +func (v *NullableVirtualCircuitCreateInput) Set(val *VirtualCircuitCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVirtualCircuitCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVirtualCircuitCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVirtualCircuitCreateInput(val *VirtualCircuitCreateInput) *NullableVirtualCircuitCreateInput { + return &NullableVirtualCircuitCreateInput{value: val, isSet: true} +} + +func (v NullableVirtualCircuitCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVirtualCircuitCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_list.go new file mode 100644 index 00000000..84bc606f --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the VirtualCircuitList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VirtualCircuitList{} + +// VirtualCircuitList struct for VirtualCircuitList +type VirtualCircuitList struct { + VirtualCircuits []VirtualCircuit `json:"virtual_circuits,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VirtualCircuitList VirtualCircuitList + +// NewVirtualCircuitList instantiates a new VirtualCircuitList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVirtualCircuitList() *VirtualCircuitList { + this := VirtualCircuitList{} + return &this +} + +// NewVirtualCircuitListWithDefaults instantiates a new VirtualCircuitList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVirtualCircuitListWithDefaults() *VirtualCircuitList { + this := VirtualCircuitList{} + return &this +} + +// GetVirtualCircuits returns the VirtualCircuits field value if set, zero value otherwise. +func (o *VirtualCircuitList) GetVirtualCircuits() []VirtualCircuit { + if o == nil || IsNil(o.VirtualCircuits) { + var ret []VirtualCircuit + return ret + } + return o.VirtualCircuits +} + +// GetVirtualCircuitsOk returns a tuple with the VirtualCircuits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualCircuitList) GetVirtualCircuitsOk() ([]VirtualCircuit, bool) { + if o == nil || IsNil(o.VirtualCircuits) { + return nil, false + } + return o.VirtualCircuits, true +} + +// HasVirtualCircuits returns a boolean if a field has been set. +func (o *VirtualCircuitList) HasVirtualCircuits() bool { + if o != nil && !IsNil(o.VirtualCircuits) { + return true + } + + return false +} + +// SetVirtualCircuits gets a reference to the given []VirtualCircuit and assigns it to the VirtualCircuits field. +func (o *VirtualCircuitList) SetVirtualCircuits(v []VirtualCircuit) { + o.VirtualCircuits = v +} + +func (o VirtualCircuitList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VirtualCircuitList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.VirtualCircuits) { + toSerialize["virtual_circuits"] = o.VirtualCircuits + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VirtualCircuitList) UnmarshalJSON(data []byte) (err error) { + varVirtualCircuitList := _VirtualCircuitList{} + + err = json.Unmarshal(data, &varVirtualCircuitList) + + if err != nil { + return err + } + + *o = VirtualCircuitList(varVirtualCircuitList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "virtual_circuits") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVirtualCircuitList struct { + value *VirtualCircuitList + isSet bool +} + +func (v NullableVirtualCircuitList) Get() *VirtualCircuitList { + return v.value +} + +func (v *NullableVirtualCircuitList) Set(val *VirtualCircuitList) { + v.value = val + v.isSet = true +} + +func (v NullableVirtualCircuitList) IsSet() bool { + return v.isSet +} + +func (v *NullableVirtualCircuitList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVirtualCircuitList(val *VirtualCircuitList) *NullableVirtualCircuitList { + return &NullableVirtualCircuitList{value: val, isSet: true} +} + +func (v NullableVirtualCircuitList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVirtualCircuitList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_update_input.go new file mode 100644 index 00000000..cee251b5 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_circuit_update_input.go @@ -0,0 +1,146 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VirtualCircuitUpdateInput - struct for VirtualCircuitUpdateInput +type VirtualCircuitUpdateInput struct { + VlanVirtualCircuitUpdateInput *VlanVirtualCircuitUpdateInput + VrfVirtualCircuitUpdateInput *VrfVirtualCircuitUpdateInput +} + +// VlanVirtualCircuitUpdateInputAsVirtualCircuitUpdateInput is a convenience function that returns VlanVirtualCircuitUpdateInput wrapped in VirtualCircuitUpdateInput +func VlanVirtualCircuitUpdateInputAsVirtualCircuitUpdateInput(v *VlanVirtualCircuitUpdateInput) VirtualCircuitUpdateInput { + return VirtualCircuitUpdateInput{ + VlanVirtualCircuitUpdateInput: v, + } +} + +// VrfVirtualCircuitUpdateInputAsVirtualCircuitUpdateInput is a convenience function that returns VrfVirtualCircuitUpdateInput wrapped in VirtualCircuitUpdateInput +func VrfVirtualCircuitUpdateInputAsVirtualCircuitUpdateInput(v *VrfVirtualCircuitUpdateInput) VirtualCircuitUpdateInput { + return VirtualCircuitUpdateInput{ + VrfVirtualCircuitUpdateInput: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *VirtualCircuitUpdateInput) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into VlanVirtualCircuitUpdateInput + err = newStrictDecoder(data).Decode(&dst.VlanVirtualCircuitUpdateInput) + if err == nil { + jsonVlanVirtualCircuitUpdateInput, _ := json.Marshal(dst.VlanVirtualCircuitUpdateInput) + if string(jsonVlanVirtualCircuitUpdateInput) == "{}" { // empty struct + dst.VlanVirtualCircuitUpdateInput = nil + } else { + match++ + } + } else { + dst.VlanVirtualCircuitUpdateInput = nil + } + + // try to unmarshal data into VrfVirtualCircuitUpdateInput + err = newStrictDecoder(data).Decode(&dst.VrfVirtualCircuitUpdateInput) + if err == nil { + jsonVrfVirtualCircuitUpdateInput, _ := json.Marshal(dst.VrfVirtualCircuitUpdateInput) + if string(jsonVrfVirtualCircuitUpdateInput) == "{}" { // empty struct + dst.VrfVirtualCircuitUpdateInput = nil + } else { + match++ + } + } else { + dst.VrfVirtualCircuitUpdateInput = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.VlanVirtualCircuitUpdateInput = nil + dst.VrfVirtualCircuitUpdateInput = nil + + return fmt.Errorf("data matches more than one schema in oneOf(VirtualCircuitUpdateInput)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(VirtualCircuitUpdateInput)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src VirtualCircuitUpdateInput) MarshalJSON() ([]byte, error) { + if src.VlanVirtualCircuitUpdateInput != nil { + return json.Marshal(&src.VlanVirtualCircuitUpdateInput) + } + + if src.VrfVirtualCircuitUpdateInput != nil { + return json.Marshal(&src.VrfVirtualCircuitUpdateInput) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *VirtualCircuitUpdateInput) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.VlanVirtualCircuitUpdateInput != nil { + return obj.VlanVirtualCircuitUpdateInput + } + + if obj.VrfVirtualCircuitUpdateInput != nil { + return obj.VrfVirtualCircuitUpdateInput + } + + // all schemas are nil + return nil +} + +type NullableVirtualCircuitUpdateInput struct { + value *VirtualCircuitUpdateInput + isSet bool +} + +func (v NullableVirtualCircuitUpdateInput) Get() *VirtualCircuitUpdateInput { + return v.value +} + +func (v *NullableVirtualCircuitUpdateInput) Set(val *VirtualCircuitUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVirtualCircuitUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVirtualCircuitUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVirtualCircuitUpdateInput(val *VirtualCircuitUpdateInput) *NullableVirtualCircuitUpdateInput { + return &NullableVirtualCircuitUpdateInput{value: val, isSet: true} +} + +func (v NullableVirtualCircuitUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVirtualCircuitUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network.go new file mode 100644 index 00000000..6cdd0aa7 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network.go @@ -0,0 +1,603 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the VirtualNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VirtualNetwork{} + +// VirtualNetwork struct for VirtualNetwork +type VirtualNetwork struct { + AssignedTo *Href `json:"assigned_to,omitempty"` + // True if the virtual network is attached to a virtual circuit. False if not. + AssignedToVirtualCircuit *bool `json:"assigned_to_virtual_circuit,omitempty"` + Description *string `json:"description,omitempty"` + Facility *Href `json:"facility,omitempty"` + Href *string `json:"href,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Id *string `json:"id,omitempty"` + // A list of instances with ports currently associated to this Virtual Network. + Instances []Href `json:"instances,omitempty"` + // A list of metal gateways currently associated to this Virtual Network. + MetalGateways []MetalGatewayLite `json:"metal_gateways,omitempty"` + Metro *Href `json:"metro,omitempty"` + // The Metro code of the metro in which this Virtual Network is defined. + MetroCode *string `json:"metro_code,omitempty"` + Vxlan *int32 `json:"vxlan,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VirtualNetwork VirtualNetwork + +// NewVirtualNetwork instantiates a new VirtualNetwork object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVirtualNetwork() *VirtualNetwork { + this := VirtualNetwork{} + return &this +} + +// NewVirtualNetworkWithDefaults instantiates a new VirtualNetwork object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVirtualNetworkWithDefaults() *VirtualNetwork { + this := VirtualNetwork{} + return &this +} + +// GetAssignedTo returns the AssignedTo field value if set, zero value otherwise. +func (o *VirtualNetwork) GetAssignedTo() Href { + if o == nil || IsNil(o.AssignedTo) { + var ret Href + return ret + } + return *o.AssignedTo +} + +// GetAssignedToOk returns a tuple with the AssignedTo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetAssignedToOk() (*Href, bool) { + if o == nil || IsNil(o.AssignedTo) { + return nil, false + } + return o.AssignedTo, true +} + +// HasAssignedTo returns a boolean if a field has been set. +func (o *VirtualNetwork) HasAssignedTo() bool { + if o != nil && !IsNil(o.AssignedTo) { + return true + } + + return false +} + +// SetAssignedTo gets a reference to the given Href and assigns it to the AssignedTo field. +func (o *VirtualNetwork) SetAssignedTo(v Href) { + o.AssignedTo = &v +} + +// GetAssignedToVirtualCircuit returns the AssignedToVirtualCircuit field value if set, zero value otherwise. +func (o *VirtualNetwork) GetAssignedToVirtualCircuit() bool { + if o == nil || IsNil(o.AssignedToVirtualCircuit) { + var ret bool + return ret + } + return *o.AssignedToVirtualCircuit +} + +// GetAssignedToVirtualCircuitOk returns a tuple with the AssignedToVirtualCircuit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetAssignedToVirtualCircuitOk() (*bool, bool) { + if o == nil || IsNil(o.AssignedToVirtualCircuit) { + return nil, false + } + return o.AssignedToVirtualCircuit, true +} + +// HasAssignedToVirtualCircuit returns a boolean if a field has been set. +func (o *VirtualNetwork) HasAssignedToVirtualCircuit() bool { + if o != nil && !IsNil(o.AssignedToVirtualCircuit) { + return true + } + + return false +} + +// SetAssignedToVirtualCircuit gets a reference to the given bool and assigns it to the AssignedToVirtualCircuit field. +func (o *VirtualNetwork) SetAssignedToVirtualCircuit(v bool) { + o.AssignedToVirtualCircuit = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VirtualNetwork) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VirtualNetwork) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VirtualNetwork) SetDescription(v string) { + o.Description = &v +} + +// GetFacility returns the Facility field value if set, zero value otherwise. +func (o *VirtualNetwork) GetFacility() Href { + if o == nil || IsNil(o.Facility) { + var ret Href + return ret + } + return *o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetFacilityOk() (*Href, bool) { + if o == nil || IsNil(o.Facility) { + return nil, false + } + return o.Facility, true +} + +// HasFacility returns a boolean if a field has been set. +func (o *VirtualNetwork) HasFacility() bool { + if o != nil && !IsNil(o.Facility) { + return true + } + + return false +} + +// SetFacility gets a reference to the given Href and assigns it to the Facility field. +func (o *VirtualNetwork) SetFacility(v Href) { + o.Facility = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *VirtualNetwork) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *VirtualNetwork) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *VirtualNetwork) SetHref(v string) { + o.Href = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *VirtualNetwork) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *VirtualNetwork) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *VirtualNetwork) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *VirtualNetwork) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *VirtualNetwork) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *VirtualNetwork) SetId(v string) { + o.Id = &v +} + +// GetInstances returns the Instances field value if set, zero value otherwise. +func (o *VirtualNetwork) GetInstances() []Href { + if o == nil || IsNil(o.Instances) { + var ret []Href + return ret + } + return o.Instances +} + +// GetInstancesOk returns a tuple with the Instances field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetInstancesOk() ([]Href, bool) { + if o == nil || IsNil(o.Instances) { + return nil, false + } + return o.Instances, true +} + +// HasInstances returns a boolean if a field has been set. +func (o *VirtualNetwork) HasInstances() bool { + if o != nil && !IsNil(o.Instances) { + return true + } + + return false +} + +// SetInstances gets a reference to the given []Href and assigns it to the Instances field. +func (o *VirtualNetwork) SetInstances(v []Href) { + o.Instances = v +} + +// GetMetalGateways returns the MetalGateways field value if set, zero value otherwise. +func (o *VirtualNetwork) GetMetalGateways() []MetalGatewayLite { + if o == nil || IsNil(o.MetalGateways) { + var ret []MetalGatewayLite + return ret + } + return o.MetalGateways +} + +// GetMetalGatewaysOk returns a tuple with the MetalGateways field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetMetalGatewaysOk() ([]MetalGatewayLite, bool) { + if o == nil || IsNil(o.MetalGateways) { + return nil, false + } + return o.MetalGateways, true +} + +// HasMetalGateways returns a boolean if a field has been set. +func (o *VirtualNetwork) HasMetalGateways() bool { + if o != nil && !IsNil(o.MetalGateways) { + return true + } + + return false +} + +// SetMetalGateways gets a reference to the given []MetalGatewayLite and assigns it to the MetalGateways field. +func (o *VirtualNetwork) SetMetalGateways(v []MetalGatewayLite) { + o.MetalGateways = v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *VirtualNetwork) GetMetro() Href { + if o == nil || IsNil(o.Metro) { + var ret Href + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetMetroOk() (*Href, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *VirtualNetwork) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given Href and assigns it to the Metro field. +func (o *VirtualNetwork) SetMetro(v Href) { + o.Metro = &v +} + +// GetMetroCode returns the MetroCode field value if set, zero value otherwise. +func (o *VirtualNetwork) GetMetroCode() string { + if o == nil || IsNil(o.MetroCode) { + var ret string + return ret + } + return *o.MetroCode +} + +// GetMetroCodeOk returns a tuple with the MetroCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetMetroCodeOk() (*string, bool) { + if o == nil || IsNil(o.MetroCode) { + return nil, false + } + return o.MetroCode, true +} + +// HasMetroCode returns a boolean if a field has been set. +func (o *VirtualNetwork) HasMetroCode() bool { + if o != nil && !IsNil(o.MetroCode) { + return true + } + + return false +} + +// SetMetroCode gets a reference to the given string and assigns it to the MetroCode field. +func (o *VirtualNetwork) SetMetroCode(v string) { + o.MetroCode = &v +} + +// GetVxlan returns the Vxlan field value if set, zero value otherwise. +func (o *VirtualNetwork) GetVxlan() int32 { + if o == nil || IsNil(o.Vxlan) { + var ret int32 + return ret + } + return *o.Vxlan +} + +// GetVxlanOk returns a tuple with the Vxlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetVxlanOk() (*int32, bool) { + if o == nil || IsNil(o.Vxlan) { + return nil, false + } + return o.Vxlan, true +} + +// HasVxlan returns a boolean if a field has been set. +func (o *VirtualNetwork) HasVxlan() bool { + if o != nil && !IsNil(o.Vxlan) { + return true + } + + return false +} + +// SetVxlan gets a reference to the given int32 and assigns it to the Vxlan field. +func (o *VirtualNetwork) SetVxlan(v int32) { + o.Vxlan = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VirtualNetwork) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetwork) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VirtualNetwork) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VirtualNetwork) SetTags(v []string) { + o.Tags = v +} + +func (o VirtualNetwork) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VirtualNetwork) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AssignedTo) { + toSerialize["assigned_to"] = o.AssignedTo + } + if !IsNil(o.AssignedToVirtualCircuit) { + toSerialize["assigned_to_virtual_circuit"] = o.AssignedToVirtualCircuit + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Facility) { + toSerialize["facility"] = o.Facility + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Instances) { + toSerialize["instances"] = o.Instances + } + if !IsNil(o.MetalGateways) { + toSerialize["metal_gateways"] = o.MetalGateways + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.MetroCode) { + toSerialize["metro_code"] = o.MetroCode + } + if !IsNil(o.Vxlan) { + toSerialize["vxlan"] = o.Vxlan + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VirtualNetwork) UnmarshalJSON(data []byte) (err error) { + varVirtualNetwork := _VirtualNetwork{} + + err = json.Unmarshal(data, &varVirtualNetwork) + + if err != nil { + return err + } + + *o = VirtualNetwork(varVirtualNetwork) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "assigned_to") + delete(additionalProperties, "assigned_to_virtual_circuit") + delete(additionalProperties, "description") + delete(additionalProperties, "facility") + delete(additionalProperties, "href") + delete(additionalProperties, "created_at") + delete(additionalProperties, "id") + delete(additionalProperties, "instances") + delete(additionalProperties, "metal_gateways") + delete(additionalProperties, "metro") + delete(additionalProperties, "metro_code") + delete(additionalProperties, "vxlan") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVirtualNetwork struct { + value *VirtualNetwork + isSet bool +} + +func (v NullableVirtualNetwork) Get() *VirtualNetwork { + return v.value +} + +func (v *NullableVirtualNetwork) Set(val *VirtualNetwork) { + v.value = val + v.isSet = true +} + +func (v NullableVirtualNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableVirtualNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVirtualNetwork(val *VirtualNetwork) *NullableVirtualNetwork { + return &NullableVirtualNetwork{value: val, isSet: true} +} + +func (v NullableVirtualNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVirtualNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network_create_input.go new file mode 100644 index 00000000..803d1740 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network_create_input.go @@ -0,0 +1,309 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the VirtualNetworkCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VirtualNetworkCreateInput{} + +// VirtualNetworkCreateInput struct for VirtualNetworkCreateInput +type VirtualNetworkCreateInput struct { + Description *string `json:"description,omitempty"` + // The UUID (or facility code) for the Facility in which to create this Virtual network. + // Deprecated + Facility *string `json:"facility,omitempty"` + // The UUID (or metro code) for the Metro in which to create this Virtual Network. + Metro *string `json:"metro,omitempty"` + // VLAN ID between 2-3999. Must be unique for the project within the Metro in which this Virtual Network is being created. If no value is specified, the next-available VLAN ID in the range 1000-1999 will be automatically selected. + Vxlan *int32 `json:"vxlan,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VirtualNetworkCreateInput VirtualNetworkCreateInput + +// NewVirtualNetworkCreateInput instantiates a new VirtualNetworkCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVirtualNetworkCreateInput() *VirtualNetworkCreateInput { + this := VirtualNetworkCreateInput{} + return &this +} + +// NewVirtualNetworkCreateInputWithDefaults instantiates a new VirtualNetworkCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVirtualNetworkCreateInputWithDefaults() *VirtualNetworkCreateInput { + this := VirtualNetworkCreateInput{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VirtualNetworkCreateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetworkCreateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VirtualNetworkCreateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VirtualNetworkCreateInput) SetDescription(v string) { + o.Description = &v +} + +// GetFacility returns the Facility field value if set, zero value otherwise. +// Deprecated +func (o *VirtualNetworkCreateInput) GetFacility() string { + if o == nil || IsNil(o.Facility) { + var ret string + return ret + } + return *o.Facility +} + +// GetFacilityOk returns a tuple with the Facility field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *VirtualNetworkCreateInput) GetFacilityOk() (*string, bool) { + if o == nil || IsNil(o.Facility) { + return nil, false + } + return o.Facility, true +} + +// HasFacility returns a boolean if a field has been set. +func (o *VirtualNetworkCreateInput) HasFacility() bool { + if o != nil && !IsNil(o.Facility) { + return true + } + + return false +} + +// SetFacility gets a reference to the given string and assigns it to the Facility field. +// Deprecated +func (o *VirtualNetworkCreateInput) SetFacility(v string) { + o.Facility = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *VirtualNetworkCreateInput) GetMetro() string { + if o == nil || IsNil(o.Metro) { + var ret string + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetworkCreateInput) GetMetroOk() (*string, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *VirtualNetworkCreateInput) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given string and assigns it to the Metro field. +func (o *VirtualNetworkCreateInput) SetMetro(v string) { + o.Metro = &v +} + +// GetVxlan returns the Vxlan field value if set, zero value otherwise. +func (o *VirtualNetworkCreateInput) GetVxlan() int32 { + if o == nil || IsNil(o.Vxlan) { + var ret int32 + return ret + } + return *o.Vxlan +} + +// GetVxlanOk returns a tuple with the Vxlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetworkCreateInput) GetVxlanOk() (*int32, bool) { + if o == nil || IsNil(o.Vxlan) { + return nil, false + } + return o.Vxlan, true +} + +// HasVxlan returns a boolean if a field has been set. +func (o *VirtualNetworkCreateInput) HasVxlan() bool { + if o != nil && !IsNil(o.Vxlan) { + return true + } + + return false +} + +// SetVxlan gets a reference to the given int32 and assigns it to the Vxlan field. +func (o *VirtualNetworkCreateInput) SetVxlan(v int32) { + o.Vxlan = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VirtualNetworkCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetworkCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VirtualNetworkCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VirtualNetworkCreateInput) SetTags(v []string) { + o.Tags = v +} + +func (o VirtualNetworkCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VirtualNetworkCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Facility) { + toSerialize["facility"] = o.Facility + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.Vxlan) { + toSerialize["vxlan"] = o.Vxlan + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VirtualNetworkCreateInput) UnmarshalJSON(data []byte) (err error) { + varVirtualNetworkCreateInput := _VirtualNetworkCreateInput{} + + err = json.Unmarshal(data, &varVirtualNetworkCreateInput) + + if err != nil { + return err + } + + *o = VirtualNetworkCreateInput(varVirtualNetworkCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "facility") + delete(additionalProperties, "metro") + delete(additionalProperties, "vxlan") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVirtualNetworkCreateInput struct { + value *VirtualNetworkCreateInput + isSet bool +} + +func (v NullableVirtualNetworkCreateInput) Get() *VirtualNetworkCreateInput { + return v.value +} + +func (v *NullableVirtualNetworkCreateInput) Set(val *VirtualNetworkCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVirtualNetworkCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVirtualNetworkCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVirtualNetworkCreateInput(val *VirtualNetworkCreateInput) *NullableVirtualNetworkCreateInput { + return &NullableVirtualNetworkCreateInput{value: val, isSet: true} +} + +func (v NullableVirtualNetworkCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVirtualNetworkCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network_list.go new file mode 100644 index 00000000..be168131 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_virtual_network_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the VirtualNetworkList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VirtualNetworkList{} + +// VirtualNetworkList struct for VirtualNetworkList +type VirtualNetworkList struct { + VirtualNetworks []VirtualNetwork `json:"virtual_networks,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VirtualNetworkList VirtualNetworkList + +// NewVirtualNetworkList instantiates a new VirtualNetworkList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVirtualNetworkList() *VirtualNetworkList { + this := VirtualNetworkList{} + return &this +} + +// NewVirtualNetworkListWithDefaults instantiates a new VirtualNetworkList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVirtualNetworkListWithDefaults() *VirtualNetworkList { + this := VirtualNetworkList{} + return &this +} + +// GetVirtualNetworks returns the VirtualNetworks field value if set, zero value otherwise. +func (o *VirtualNetworkList) GetVirtualNetworks() []VirtualNetwork { + if o == nil || IsNil(o.VirtualNetworks) { + var ret []VirtualNetwork + return ret + } + return o.VirtualNetworks +} + +// GetVirtualNetworksOk returns a tuple with the VirtualNetworks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualNetworkList) GetVirtualNetworksOk() ([]VirtualNetwork, bool) { + if o == nil || IsNil(o.VirtualNetworks) { + return nil, false + } + return o.VirtualNetworks, true +} + +// HasVirtualNetworks returns a boolean if a field has been set. +func (o *VirtualNetworkList) HasVirtualNetworks() bool { + if o != nil && !IsNil(o.VirtualNetworks) { + return true + } + + return false +} + +// SetVirtualNetworks gets a reference to the given []VirtualNetwork and assigns it to the VirtualNetworks field. +func (o *VirtualNetworkList) SetVirtualNetworks(v []VirtualNetwork) { + o.VirtualNetworks = v +} + +func (o VirtualNetworkList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VirtualNetworkList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.VirtualNetworks) { + toSerialize["virtual_networks"] = o.VirtualNetworks + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VirtualNetworkList) UnmarshalJSON(data []byte) (err error) { + varVirtualNetworkList := _VirtualNetworkList{} + + err = json.Unmarshal(data, &varVirtualNetworkList) + + if err != nil { + return err + } + + *o = VirtualNetworkList(varVirtualNetworkList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "virtual_networks") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVirtualNetworkList struct { + value *VirtualNetworkList + isSet bool +} + +func (v NullableVirtualNetworkList) Get() *VirtualNetworkList { + return v.value +} + +func (v *NullableVirtualNetworkList) Set(val *VirtualNetworkList) { + v.value = val + v.isSet = true +} + +func (v NullableVirtualNetworkList) IsSet() bool { + return v.isSet +} + +func (v *NullableVirtualNetworkList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVirtualNetworkList(val *VirtualNetworkList) *NullableVirtualNetworkList { + return &NullableVirtualNetworkList{value: val, isSet: true} +} + +func (v NullableVirtualNetworkList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVirtualNetworkList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input.go new file mode 100644 index 00000000..8c633560 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input.go @@ -0,0 +1,510 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the VlanFabricVcCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VlanFabricVcCreateInput{} + +// VlanFabricVcCreateInput struct for VlanFabricVcCreateInput +type VlanFabricVcCreateInput struct { + // The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key. + ContactEmail *string `json:"contact_email,omitempty"` + Description *string `json:"description,omitempty"` + // A Metro ID or code. When creating Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), or shared connections, this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here. + Metro string `json:"metro"` + Name string `json:"name"` + Project *string `json:"project,omitempty"` + // Either 'primary' or 'redundant'. + Redundancy string `json:"redundancy"` + ServiceTokenType VlanFabricVcCreateInputServiceTokenType `json:"service_token_type"` + // A interconnection speed, in bps, mbps, or gbps. For Fabric VCs, this represents the maximum speed of the interconnection. For Fabric VCs (Metal Billed), this can only be one of the following: ''50mbps'', ''200mbps'', ''500mbps'', ''1gbps'', ''2gbps'', ''5gbps'' or ''10gbps'', and is required for creation. For Fabric VCs (Fabric Billed), this field will always default to ''10gbps'' even if it is not provided. For example, ''500000000'', ''50m'', or' ''500mbps'' will all work as valid inputs. + Speed *int32 `json:"speed,omitempty"` + Tags []string `json:"tags,omitempty"` + Type VlanFabricVcCreateInputType `json:"type"` + // A list of one or two metro-based VLANs that will be set on the virtual circuits of primary and/or secondary (if redundant) interconnections respectively when creating Fabric VCs. VLANs can also be set after the interconnection is created, but are required to fully activate the virtual circuits. + Vlans []int32 `json:"vlans,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VlanFabricVcCreateInput VlanFabricVcCreateInput + +// NewVlanFabricVcCreateInput instantiates a new VlanFabricVcCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVlanFabricVcCreateInput(metro string, name string, redundancy string, serviceTokenType VlanFabricVcCreateInputServiceTokenType, type_ VlanFabricVcCreateInputType) *VlanFabricVcCreateInput { + this := VlanFabricVcCreateInput{} + this.Metro = metro + this.Name = name + this.Redundancy = redundancy + this.ServiceTokenType = serviceTokenType + this.Type = type_ + return &this +} + +// NewVlanFabricVcCreateInputWithDefaults instantiates a new VlanFabricVcCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVlanFabricVcCreateInputWithDefaults() *VlanFabricVcCreateInput { + this := VlanFabricVcCreateInput{} + return &this +} + +// GetContactEmail returns the ContactEmail field value if set, zero value otherwise. +func (o *VlanFabricVcCreateInput) GetContactEmail() string { + if o == nil || IsNil(o.ContactEmail) { + var ret string + return ret + } + return *o.ContactEmail +} + +// GetContactEmailOk returns a tuple with the ContactEmail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanFabricVcCreateInput) GetContactEmailOk() (*string, bool) { + if o == nil || IsNil(o.ContactEmail) { + return nil, false + } + return o.ContactEmail, true +} + +// HasContactEmail returns a boolean if a field has been set. +func (o *VlanFabricVcCreateInput) HasContactEmail() bool { + if o != nil && !IsNil(o.ContactEmail) { + return true + } + + return false +} + +// SetContactEmail gets a reference to the given string and assigns it to the ContactEmail field. +func (o *VlanFabricVcCreateInput) SetContactEmail(v string) { + o.ContactEmail = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VlanFabricVcCreateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanFabricVcCreateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VlanFabricVcCreateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VlanFabricVcCreateInput) SetDescription(v string) { + o.Description = &v +} + +// GetMetro returns the Metro field value +func (o *VlanFabricVcCreateInput) GetMetro() string { + if o == nil { + var ret string + return ret + } + + return o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value +// and a boolean to check if the value has been set. +func (o *VlanFabricVcCreateInput) GetMetroOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metro, true +} + +// SetMetro sets field value +func (o *VlanFabricVcCreateInput) SetMetro(v string) { + o.Metro = v +} + +// GetName returns the Name field value +func (o *VlanFabricVcCreateInput) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *VlanFabricVcCreateInput) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *VlanFabricVcCreateInput) SetName(v string) { + o.Name = v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *VlanFabricVcCreateInput) GetProject() string { + if o == nil || IsNil(o.Project) { + var ret string + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanFabricVcCreateInput) GetProjectOk() (*string, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *VlanFabricVcCreateInput) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given string and assigns it to the Project field. +func (o *VlanFabricVcCreateInput) SetProject(v string) { + o.Project = &v +} + +// GetRedundancy returns the Redundancy field value +func (o *VlanFabricVcCreateInput) GetRedundancy() string { + if o == nil { + var ret string + return ret + } + + return o.Redundancy +} + +// GetRedundancyOk returns a tuple with the Redundancy field value +// and a boolean to check if the value has been set. +func (o *VlanFabricVcCreateInput) GetRedundancyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Redundancy, true +} + +// SetRedundancy sets field value +func (o *VlanFabricVcCreateInput) SetRedundancy(v string) { + o.Redundancy = v +} + +// GetServiceTokenType returns the ServiceTokenType field value +func (o *VlanFabricVcCreateInput) GetServiceTokenType() VlanFabricVcCreateInputServiceTokenType { + if o == nil { + var ret VlanFabricVcCreateInputServiceTokenType + return ret + } + + return o.ServiceTokenType +} + +// GetServiceTokenTypeOk returns a tuple with the ServiceTokenType field value +// and a boolean to check if the value has been set. +func (o *VlanFabricVcCreateInput) GetServiceTokenTypeOk() (*VlanFabricVcCreateInputServiceTokenType, bool) { + if o == nil { + return nil, false + } + return &o.ServiceTokenType, true +} + +// SetServiceTokenType sets field value +func (o *VlanFabricVcCreateInput) SetServiceTokenType(v VlanFabricVcCreateInputServiceTokenType) { + o.ServiceTokenType = v +} + +// GetSpeed returns the Speed field value if set, zero value otherwise. +func (o *VlanFabricVcCreateInput) GetSpeed() int32 { + if o == nil || IsNil(o.Speed) { + var ret int32 + return ret + } + return *o.Speed +} + +// GetSpeedOk returns a tuple with the Speed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanFabricVcCreateInput) GetSpeedOk() (*int32, bool) { + if o == nil || IsNil(o.Speed) { + return nil, false + } + return o.Speed, true +} + +// HasSpeed returns a boolean if a field has been set. +func (o *VlanFabricVcCreateInput) HasSpeed() bool { + if o != nil && !IsNil(o.Speed) { + return true + } + + return false +} + +// SetSpeed gets a reference to the given int32 and assigns it to the Speed field. +func (o *VlanFabricVcCreateInput) SetSpeed(v int32) { + o.Speed = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VlanFabricVcCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanFabricVcCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VlanFabricVcCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VlanFabricVcCreateInput) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value +func (o *VlanFabricVcCreateInput) GetType() VlanFabricVcCreateInputType { + if o == nil { + var ret VlanFabricVcCreateInputType + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *VlanFabricVcCreateInput) GetTypeOk() (*VlanFabricVcCreateInputType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *VlanFabricVcCreateInput) SetType(v VlanFabricVcCreateInputType) { + o.Type = v +} + +// GetVlans returns the Vlans field value if set, zero value otherwise. +func (o *VlanFabricVcCreateInput) GetVlans() []int32 { + if o == nil || IsNil(o.Vlans) { + var ret []int32 + return ret + } + return o.Vlans +} + +// GetVlansOk returns a tuple with the Vlans field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanFabricVcCreateInput) GetVlansOk() ([]int32, bool) { + if o == nil || IsNil(o.Vlans) { + return nil, false + } + return o.Vlans, true +} + +// HasVlans returns a boolean if a field has been set. +func (o *VlanFabricVcCreateInput) HasVlans() bool { + if o != nil && !IsNil(o.Vlans) { + return true + } + + return false +} + +// SetVlans gets a reference to the given []int32 and assigns it to the Vlans field. +func (o *VlanFabricVcCreateInput) SetVlans(v []int32) { + o.Vlans = v +} + +func (o VlanFabricVcCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VlanFabricVcCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ContactEmail) { + toSerialize["contact_email"] = o.ContactEmail + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["metro"] = o.Metro + toSerialize["name"] = o.Name + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + toSerialize["redundancy"] = o.Redundancy + toSerialize["service_token_type"] = o.ServiceTokenType + if !IsNil(o.Speed) { + toSerialize["speed"] = o.Speed + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + toSerialize["type"] = o.Type + if !IsNil(o.Vlans) { + toSerialize["vlans"] = o.Vlans + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VlanFabricVcCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "metro", + "name", + "redundancy", + "service_token_type", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVlanFabricVcCreateInput := _VlanFabricVcCreateInput{} + + err = json.Unmarshal(data, &varVlanFabricVcCreateInput) + + if err != nil { + return err + } + + *o = VlanFabricVcCreateInput(varVlanFabricVcCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "contact_email") + delete(additionalProperties, "description") + delete(additionalProperties, "metro") + delete(additionalProperties, "name") + delete(additionalProperties, "project") + delete(additionalProperties, "redundancy") + delete(additionalProperties, "service_token_type") + delete(additionalProperties, "speed") + delete(additionalProperties, "tags") + delete(additionalProperties, "type") + delete(additionalProperties, "vlans") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVlanFabricVcCreateInput struct { + value *VlanFabricVcCreateInput + isSet bool +} + +func (v NullableVlanFabricVcCreateInput) Get() *VlanFabricVcCreateInput { + return v.value +} + +func (v *NullableVlanFabricVcCreateInput) Set(val *VlanFabricVcCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVlanFabricVcCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVlanFabricVcCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVlanFabricVcCreateInput(val *VlanFabricVcCreateInput) *NullableVlanFabricVcCreateInput { + return &NullableVlanFabricVcCreateInput{value: val, isSet: true} +} + +func (v NullableVlanFabricVcCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVlanFabricVcCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input_service_token_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input_service_token_type.go new file mode 100644 index 00000000..a3d787d9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input_service_token_type.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VlanFabricVcCreateInputServiceTokenType Either 'a_side' or 'z_side'. Setting this field to 'a_side' will create an interconnection with Fabric VCs (Metal Billed). Setting this field to 'z_side' will create an interconnection with Fabric VCs (Fabric Billed). This is required when the 'type' is 'shared', but this is not applicable when the 'type' is 'dedicated'. This parameter is included in the specification as a developer preview and is generally unavailable. Please contact our Support team for more details. +type VlanFabricVcCreateInputServiceTokenType string + +// List of VlanFabricVcCreateInput_service_token_type +const ( + VLANFABRICVCCREATEINPUTSERVICETOKENTYPE_A_SIDE VlanFabricVcCreateInputServiceTokenType = "a_side" + VLANFABRICVCCREATEINPUTSERVICETOKENTYPE_Z_SIDE VlanFabricVcCreateInputServiceTokenType = "z_side" +) + +// All allowed values of VlanFabricVcCreateInputServiceTokenType enum +var AllowedVlanFabricVcCreateInputServiceTokenTypeEnumValues = []VlanFabricVcCreateInputServiceTokenType{ + "a_side", + "z_side", +} + +func (v *VlanFabricVcCreateInputServiceTokenType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VlanFabricVcCreateInputServiceTokenType(value) + for _, existing := range AllowedVlanFabricVcCreateInputServiceTokenTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid VlanFabricVcCreateInputServiceTokenType", value) +} + +// NewVlanFabricVcCreateInputServiceTokenTypeFromValue returns a pointer to a valid VlanFabricVcCreateInputServiceTokenType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVlanFabricVcCreateInputServiceTokenTypeFromValue(v string) (*VlanFabricVcCreateInputServiceTokenType, error) { + ev := VlanFabricVcCreateInputServiceTokenType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VlanFabricVcCreateInputServiceTokenType: valid values are %v", v, AllowedVlanFabricVcCreateInputServiceTokenTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VlanFabricVcCreateInputServiceTokenType) IsValid() bool { + for _, existing := range AllowedVlanFabricVcCreateInputServiceTokenTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VlanFabricVcCreateInput_service_token_type value +func (v VlanFabricVcCreateInputServiceTokenType) Ptr() *VlanFabricVcCreateInputServiceTokenType { + return &v +} + +type NullableVlanFabricVcCreateInputServiceTokenType struct { + value *VlanFabricVcCreateInputServiceTokenType + isSet bool +} + +func (v NullableVlanFabricVcCreateInputServiceTokenType) Get() *VlanFabricVcCreateInputServiceTokenType { + return v.value +} + +func (v *NullableVlanFabricVcCreateInputServiceTokenType) Set(val *VlanFabricVcCreateInputServiceTokenType) { + v.value = val + v.isSet = true +} + +func (v NullableVlanFabricVcCreateInputServiceTokenType) IsSet() bool { + return v.isSet +} + +func (v *NullableVlanFabricVcCreateInputServiceTokenType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVlanFabricVcCreateInputServiceTokenType(val *VlanFabricVcCreateInputServiceTokenType) *NullableVlanFabricVcCreateInputServiceTokenType { + return &NullableVlanFabricVcCreateInputServiceTokenType{value: val, isSet: true} +} + +func (v NullableVlanFabricVcCreateInputServiceTokenType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVlanFabricVcCreateInputServiceTokenType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input_type.go new file mode 100644 index 00000000..1f3e7ed8 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_fabric_vc_create_input_type.go @@ -0,0 +1,109 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VlanFabricVcCreateInputType When requesting for a Fabric VC, the value of this field should be 'shared'. +type VlanFabricVcCreateInputType string + +// List of VlanFabricVcCreateInput_type +const ( + VLANFABRICVCCREATEINPUTTYPE_SHARED VlanFabricVcCreateInputType = "shared" +) + +// All allowed values of VlanFabricVcCreateInputType enum +var AllowedVlanFabricVcCreateInputTypeEnumValues = []VlanFabricVcCreateInputType{ + "shared", +} + +func (v *VlanFabricVcCreateInputType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VlanFabricVcCreateInputType(value) + for _, existing := range AllowedVlanFabricVcCreateInputTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid VlanFabricVcCreateInputType", value) +} + +// NewVlanFabricVcCreateInputTypeFromValue returns a pointer to a valid VlanFabricVcCreateInputType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVlanFabricVcCreateInputTypeFromValue(v string) (*VlanFabricVcCreateInputType, error) { + ev := VlanFabricVcCreateInputType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VlanFabricVcCreateInputType: valid values are %v", v, AllowedVlanFabricVcCreateInputTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VlanFabricVcCreateInputType) IsValid() bool { + for _, existing := range AllowedVlanFabricVcCreateInputTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VlanFabricVcCreateInput_type value +func (v VlanFabricVcCreateInputType) Ptr() *VlanFabricVcCreateInputType { + return &v +} + +type NullableVlanFabricVcCreateInputType struct { + value *VlanFabricVcCreateInputType + isSet bool +} + +func (v NullableVlanFabricVcCreateInputType) Get() *VlanFabricVcCreateInputType { + return v.value +} + +func (v *NullableVlanFabricVcCreateInputType) Set(val *VlanFabricVcCreateInputType) { + v.value = val + v.isSet = true +} + +func (v NullableVlanFabricVcCreateInputType) IsSet() bool { + return v.isSet +} + +func (v *NullableVlanFabricVcCreateInputType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVlanFabricVcCreateInputType(val *VlanFabricVcCreateInputType) *NullableVlanFabricVcCreateInputType { + return &NullableVlanFabricVcCreateInputType{value: val, isSet: true} +} + +func (v NullableVlanFabricVcCreateInputType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVlanFabricVcCreateInputType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit.go new file mode 100644 index 00000000..fda78b08 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit.go @@ -0,0 +1,727 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the VlanVirtualCircuit type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VlanVirtualCircuit{} + +// VlanVirtualCircuit struct for VlanVirtualCircuit +type VlanVirtualCircuit struct { + // True if the Virtual Circuit is being billed. Currently, only Virtual Circuits of Fabric VCs (Metal Billed) will be billed. Usage will start the first time the Virtual Circuit becomes active, and will not stop until it is deleted from Metal. + Bill *bool `json:"bill,omitempty"` + BillType NullableVlanVirtualCircuitBillType `json:"bill_type,omitempty"` + Description *string `json:"description,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + NniVlan *int32 `json:"nni_vlan,omitempty"` + Port *Href `json:"port,omitempty"` + Project *Href `json:"project,omitempty"` + // For Virtual Circuits on shared and dedicated connections, this speed should match the one set on their Interconnection Ports. For Virtual Circuits on Fabric VCs (both Metal and Fabric Billed) that have found their corresponding Fabric connection, this is the actual speed of the interconnection that was configured when setting up the interconnection on the Fabric Portal. Details on Fabric VCs are included in the specification as a developer preview and is generally unavailable. Please contact our Support team for more details. + Speed *int64 `json:"speed,omitempty"` + Status *VlanVirtualCircuitStatus `json:"status,omitempty"` + Tags []string `json:"tags,omitempty"` + Type *VlanVirtualCircuitType `json:"type,omitempty"` + VirtualNetwork *Href `json:"virtual_network,omitempty"` + Vnid *int32 `json:"vnid,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VlanVirtualCircuit VlanVirtualCircuit + +// NewVlanVirtualCircuit instantiates a new VlanVirtualCircuit object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVlanVirtualCircuit() *VlanVirtualCircuit { + this := VlanVirtualCircuit{} + var bill bool = false + this.Bill = &bill + return &this +} + +// NewVlanVirtualCircuitWithDefaults instantiates a new VlanVirtualCircuit object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVlanVirtualCircuitWithDefaults() *VlanVirtualCircuit { + this := VlanVirtualCircuit{} + var bill bool = false + this.Bill = &bill + return &this +} + +// GetBill returns the Bill field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetBill() bool { + if o == nil || IsNil(o.Bill) { + var ret bool + return ret + } + return *o.Bill +} + +// GetBillOk returns a tuple with the Bill field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetBillOk() (*bool, bool) { + if o == nil || IsNil(o.Bill) { + return nil, false + } + return o.Bill, true +} + +// HasBill returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasBill() bool { + if o != nil && !IsNil(o.Bill) { + return true + } + + return false +} + +// SetBill gets a reference to the given bool and assigns it to the Bill field. +func (o *VlanVirtualCircuit) SetBill(v bool) { + o.Bill = &v +} + +// GetBillType returns the BillType field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *VlanVirtualCircuit) GetBillType() VlanVirtualCircuitBillType { + if o == nil || IsNil(o.BillType.Get()) { + var ret VlanVirtualCircuitBillType + return ret + } + return *o.BillType.Get() +} + +// GetBillTypeOk returns a tuple with the BillType field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VlanVirtualCircuit) GetBillTypeOk() (*VlanVirtualCircuitBillType, bool) { + if o == nil { + return nil, false + } + return o.BillType.Get(), o.BillType.IsSet() +} + +// HasBillType returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasBillType() bool { + if o != nil && o.BillType.IsSet() { + return true + } + + return false +} + +// SetBillType gets a reference to the given NullableVlanVirtualCircuitBillType and assigns it to the BillType field. +func (o *VlanVirtualCircuit) SetBillType(v VlanVirtualCircuitBillType) { + o.BillType.Set(&v) +} + +// SetBillTypeNil sets the value for BillType to be an explicit nil +func (o *VlanVirtualCircuit) SetBillTypeNil() { + o.BillType.Set(nil) +} + +// UnsetBillType ensures that no value is present for BillType, not even an explicit nil +func (o *VlanVirtualCircuit) UnsetBillType() { + o.BillType.Unset() +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VlanVirtualCircuit) SetDescription(v string) { + o.Description = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *VlanVirtualCircuit) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VlanVirtualCircuit) SetName(v string) { + o.Name = &v +} + +// GetNniVlan returns the NniVlan field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetNniVlan() int32 { + if o == nil || IsNil(o.NniVlan) { + var ret int32 + return ret + } + return *o.NniVlan +} + +// GetNniVlanOk returns a tuple with the NniVlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetNniVlanOk() (*int32, bool) { + if o == nil || IsNil(o.NniVlan) { + return nil, false + } + return o.NniVlan, true +} + +// HasNniVlan returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasNniVlan() bool { + if o != nil && !IsNil(o.NniVlan) { + return true + } + + return false +} + +// SetNniVlan gets a reference to the given int32 and assigns it to the NniVlan field. +func (o *VlanVirtualCircuit) SetNniVlan(v int32) { + o.NniVlan = &v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetPort() Href { + if o == nil || IsNil(o.Port) { + var ret Href + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetPortOk() (*Href, bool) { + if o == nil || IsNil(o.Port) { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasPort() bool { + if o != nil && !IsNil(o.Port) { + return true + } + + return false +} + +// SetPort gets a reference to the given Href and assigns it to the Port field. +func (o *VlanVirtualCircuit) SetPort(v Href) { + o.Port = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetProject() Href { + if o == nil || IsNil(o.Project) { + var ret Href + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetProjectOk() (*Href, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Href and assigns it to the Project field. +func (o *VlanVirtualCircuit) SetProject(v Href) { + o.Project = &v +} + +// GetSpeed returns the Speed field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetSpeed() int64 { + if o == nil || IsNil(o.Speed) { + var ret int64 + return ret + } + return *o.Speed +} + +// GetSpeedOk returns a tuple with the Speed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetSpeedOk() (*int64, bool) { + if o == nil || IsNil(o.Speed) { + return nil, false + } + return o.Speed, true +} + +// HasSpeed returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasSpeed() bool { + if o != nil && !IsNil(o.Speed) { + return true + } + + return false +} + +// SetSpeed gets a reference to the given int64 and assigns it to the Speed field. +func (o *VlanVirtualCircuit) SetSpeed(v int64) { + o.Speed = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetStatus() VlanVirtualCircuitStatus { + if o == nil || IsNil(o.Status) { + var ret VlanVirtualCircuitStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetStatusOk() (*VlanVirtualCircuitStatus, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given VlanVirtualCircuitStatus and assigns it to the Status field. +func (o *VlanVirtualCircuit) SetStatus(v VlanVirtualCircuitStatus) { + o.Status = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VlanVirtualCircuit) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetType() VlanVirtualCircuitType { + if o == nil || IsNil(o.Type) { + var ret VlanVirtualCircuitType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetTypeOk() (*VlanVirtualCircuitType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given VlanVirtualCircuitType and assigns it to the Type field. +func (o *VlanVirtualCircuit) SetType(v VlanVirtualCircuitType) { + o.Type = &v +} + +// GetVirtualNetwork returns the VirtualNetwork field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetVirtualNetwork() Href { + if o == nil || IsNil(o.VirtualNetwork) { + var ret Href + return ret + } + return *o.VirtualNetwork +} + +// GetVirtualNetworkOk returns a tuple with the VirtualNetwork field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetVirtualNetworkOk() (*Href, bool) { + if o == nil || IsNil(o.VirtualNetwork) { + return nil, false + } + return o.VirtualNetwork, true +} + +// HasVirtualNetwork returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasVirtualNetwork() bool { + if o != nil && !IsNil(o.VirtualNetwork) { + return true + } + + return false +} + +// SetVirtualNetwork gets a reference to the given Href and assigns it to the VirtualNetwork field. +func (o *VlanVirtualCircuit) SetVirtualNetwork(v Href) { + o.VirtualNetwork = &v +} + +// GetVnid returns the Vnid field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetVnid() int32 { + if o == nil || IsNil(o.Vnid) { + var ret int32 + return ret + } + return *o.Vnid +} + +// GetVnidOk returns a tuple with the Vnid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetVnidOk() (*int32, bool) { + if o == nil || IsNil(o.Vnid) { + return nil, false + } + return o.Vnid, true +} + +// HasVnid returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasVnid() bool { + if o != nil && !IsNil(o.Vnid) { + return true + } + + return false +} + +// SetVnid gets a reference to the given int32 and assigns it to the Vnid field. +func (o *VlanVirtualCircuit) SetVnid(v int32) { + o.Vnid = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *VlanVirtualCircuit) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *VlanVirtualCircuit) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuit) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *VlanVirtualCircuit) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *VlanVirtualCircuit) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o VlanVirtualCircuit) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VlanVirtualCircuit) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Bill) { + toSerialize["bill"] = o.Bill + } + if o.BillType.IsSet() { + toSerialize["bill_type"] = o.BillType.Get() + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.NniVlan) { + toSerialize["nni_vlan"] = o.NniVlan + } + if !IsNil(o.Port) { + toSerialize["port"] = o.Port + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.Speed) { + toSerialize["speed"] = o.Speed + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.VirtualNetwork) { + toSerialize["virtual_network"] = o.VirtualNetwork + } + if !IsNil(o.Vnid) { + toSerialize["vnid"] = o.Vnid + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VlanVirtualCircuit) UnmarshalJSON(data []byte) (err error) { + varVlanVirtualCircuit := _VlanVirtualCircuit{} + + err = json.Unmarshal(data, &varVlanVirtualCircuit) + + if err != nil { + return err + } + + *o = VlanVirtualCircuit(varVlanVirtualCircuit) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bill") + delete(additionalProperties, "bill_type") + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "nni_vlan") + delete(additionalProperties, "port") + delete(additionalProperties, "project") + delete(additionalProperties, "speed") + delete(additionalProperties, "status") + delete(additionalProperties, "tags") + delete(additionalProperties, "type") + delete(additionalProperties, "virtual_network") + delete(additionalProperties, "vnid") + delete(additionalProperties, "created_at") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVlanVirtualCircuit struct { + value *VlanVirtualCircuit + isSet bool +} + +func (v NullableVlanVirtualCircuit) Get() *VlanVirtualCircuit { + return v.value +} + +func (v *NullableVlanVirtualCircuit) Set(val *VlanVirtualCircuit) { + v.value = val + v.isSet = true +} + +func (v NullableVlanVirtualCircuit) IsSet() bool { + return v.isSet +} + +func (v *NullableVlanVirtualCircuit) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVlanVirtualCircuit(val *VlanVirtualCircuit) *NullableVlanVirtualCircuit { + return &NullableVlanVirtualCircuit{value: val, isSet: true} +} + +func (v NullableVlanVirtualCircuit) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVlanVirtualCircuit) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_bill_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_bill_type.go new file mode 100644 index 00000000..c0a5ffaf --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_bill_type.go @@ -0,0 +1,111 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VlanVirtualCircuitBillType Fabric Billed if the Virtual Circuit is billed by Fabric. Metal Billed if the Virtual Circuit is billed by Metal. Legacy Virtual Circuits will have a value of nil. +type VlanVirtualCircuitBillType string + +// List of VlanVirtualCircuit_bill_type +const ( + VLANVIRTUALCIRCUITBILLTYPE_METAL_BILLED VlanVirtualCircuitBillType = "metal_billed" + VLANVIRTUALCIRCUITBILLTYPE_FABRIC_BILLED VlanVirtualCircuitBillType = "fabric_billed" +) + +// All allowed values of VlanVirtualCircuitBillType enum +var AllowedVlanVirtualCircuitBillTypeEnumValues = []VlanVirtualCircuitBillType{ + "metal_billed", + "fabric_billed", +} + +func (v *VlanVirtualCircuitBillType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VlanVirtualCircuitBillType(value) + for _, existing := range AllowedVlanVirtualCircuitBillTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid VlanVirtualCircuitBillType", value) +} + +// NewVlanVirtualCircuitBillTypeFromValue returns a pointer to a valid VlanVirtualCircuitBillType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVlanVirtualCircuitBillTypeFromValue(v string) (*VlanVirtualCircuitBillType, error) { + ev := VlanVirtualCircuitBillType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VlanVirtualCircuitBillType: valid values are %v", v, AllowedVlanVirtualCircuitBillTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VlanVirtualCircuitBillType) IsValid() bool { + for _, existing := range AllowedVlanVirtualCircuitBillTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VlanVirtualCircuit_bill_type value +func (v VlanVirtualCircuitBillType) Ptr() *VlanVirtualCircuitBillType { + return &v +} + +type NullableVlanVirtualCircuitBillType struct { + value *VlanVirtualCircuitBillType + isSet bool +} + +func (v NullableVlanVirtualCircuitBillType) Get() *VlanVirtualCircuitBillType { + return v.value +} + +func (v *NullableVlanVirtualCircuitBillType) Set(val *VlanVirtualCircuitBillType) { + v.value = val + v.isSet = true +} + +func (v NullableVlanVirtualCircuitBillType) IsSet() bool { + return v.isSet +} + +func (v *NullableVlanVirtualCircuitBillType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVlanVirtualCircuitBillType(val *VlanVirtualCircuitBillType) *NullableVlanVirtualCircuitBillType { + return &NullableVlanVirtualCircuitBillType{value: val, isSet: true} +} + +func (v NullableVlanVirtualCircuitBillType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVlanVirtualCircuitBillType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_create_input.go new file mode 100644 index 00000000..4d4b2792 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_create_input.go @@ -0,0 +1,391 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the VlanVirtualCircuitCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VlanVirtualCircuitCreateInput{} + +// VlanVirtualCircuitCreateInput struct for VlanVirtualCircuitCreateInput +type VlanVirtualCircuitCreateInput struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + NniVlan *int32 `json:"nni_vlan,omitempty"` + ProjectId string `json:"project_id"` + // speed can be passed as integer number representing bps speed or string (e.g. '52m' or '100g' or '4 gbps') + Speed *int64 `json:"speed,omitempty"` + Tags []string `json:"tags,omitempty"` + // A Virtual Network record UUID or the VNID of a Metro Virtual Network in your project (sent as integer). + Vnid *string `json:"vnid,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VlanVirtualCircuitCreateInput VlanVirtualCircuitCreateInput + +// NewVlanVirtualCircuitCreateInput instantiates a new VlanVirtualCircuitCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVlanVirtualCircuitCreateInput(projectId string) *VlanVirtualCircuitCreateInput { + this := VlanVirtualCircuitCreateInput{} + this.ProjectId = projectId + return &this +} + +// NewVlanVirtualCircuitCreateInputWithDefaults instantiates a new VlanVirtualCircuitCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVlanVirtualCircuitCreateInputWithDefaults() *VlanVirtualCircuitCreateInput { + this := VlanVirtualCircuitCreateInput{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VlanVirtualCircuitCreateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitCreateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VlanVirtualCircuitCreateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VlanVirtualCircuitCreateInput) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VlanVirtualCircuitCreateInput) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitCreateInput) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *VlanVirtualCircuitCreateInput) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VlanVirtualCircuitCreateInput) SetName(v string) { + o.Name = &v +} + +// GetNniVlan returns the NniVlan field value if set, zero value otherwise. +func (o *VlanVirtualCircuitCreateInput) GetNniVlan() int32 { + if o == nil || IsNil(o.NniVlan) { + var ret int32 + return ret + } + return *o.NniVlan +} + +// GetNniVlanOk returns a tuple with the NniVlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitCreateInput) GetNniVlanOk() (*int32, bool) { + if o == nil || IsNil(o.NniVlan) { + return nil, false + } + return o.NniVlan, true +} + +// HasNniVlan returns a boolean if a field has been set. +func (o *VlanVirtualCircuitCreateInput) HasNniVlan() bool { + if o != nil && !IsNil(o.NniVlan) { + return true + } + + return false +} + +// SetNniVlan gets a reference to the given int32 and assigns it to the NniVlan field. +func (o *VlanVirtualCircuitCreateInput) SetNniVlan(v int32) { + o.NniVlan = &v +} + +// GetProjectId returns the ProjectId field value +func (o *VlanVirtualCircuitCreateInput) GetProjectId() string { + if o == nil { + var ret string + return ret + } + + return o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitCreateInput) GetProjectIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ProjectId, true +} + +// SetProjectId sets field value +func (o *VlanVirtualCircuitCreateInput) SetProjectId(v string) { + o.ProjectId = v +} + +// GetSpeed returns the Speed field value if set, zero value otherwise. +func (o *VlanVirtualCircuitCreateInput) GetSpeed() int64 { + if o == nil || IsNil(o.Speed) { + var ret int64 + return ret + } + return *o.Speed +} + +// GetSpeedOk returns a tuple with the Speed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitCreateInput) GetSpeedOk() (*int64, bool) { + if o == nil || IsNil(o.Speed) { + return nil, false + } + return o.Speed, true +} + +// HasSpeed returns a boolean if a field has been set. +func (o *VlanVirtualCircuitCreateInput) HasSpeed() bool { + if o != nil && !IsNil(o.Speed) { + return true + } + + return false +} + +// SetSpeed gets a reference to the given int64 and assigns it to the Speed field. +func (o *VlanVirtualCircuitCreateInput) SetSpeed(v int64) { + o.Speed = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VlanVirtualCircuitCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VlanVirtualCircuitCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VlanVirtualCircuitCreateInput) SetTags(v []string) { + o.Tags = v +} + +// GetVnid returns the Vnid field value if set, zero value otherwise. +func (o *VlanVirtualCircuitCreateInput) GetVnid() string { + if o == nil || IsNil(o.Vnid) { + var ret string + return ret + } + return *o.Vnid +} + +// GetVnidOk returns a tuple with the Vnid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitCreateInput) GetVnidOk() (*string, bool) { + if o == nil || IsNil(o.Vnid) { + return nil, false + } + return o.Vnid, true +} + +// HasVnid returns a boolean if a field has been set. +func (o *VlanVirtualCircuitCreateInput) HasVnid() bool { + if o != nil && !IsNil(o.Vnid) { + return true + } + + return false +} + +// SetVnid gets a reference to the given string and assigns it to the Vnid field. +func (o *VlanVirtualCircuitCreateInput) SetVnid(v string) { + o.Vnid = &v +} + +func (o VlanVirtualCircuitCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VlanVirtualCircuitCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.NniVlan) { + toSerialize["nni_vlan"] = o.NniVlan + } + toSerialize["project_id"] = o.ProjectId + if !IsNil(o.Speed) { + toSerialize["speed"] = o.Speed + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Vnid) { + toSerialize["vnid"] = o.Vnid + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VlanVirtualCircuitCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "project_id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVlanVirtualCircuitCreateInput := _VlanVirtualCircuitCreateInput{} + + err = json.Unmarshal(data, &varVlanVirtualCircuitCreateInput) + + if err != nil { + return err + } + + *o = VlanVirtualCircuitCreateInput(varVlanVirtualCircuitCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "name") + delete(additionalProperties, "nni_vlan") + delete(additionalProperties, "project_id") + delete(additionalProperties, "speed") + delete(additionalProperties, "tags") + delete(additionalProperties, "vnid") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVlanVirtualCircuitCreateInput struct { + value *VlanVirtualCircuitCreateInput + isSet bool +} + +func (v NullableVlanVirtualCircuitCreateInput) Get() *VlanVirtualCircuitCreateInput { + return v.value +} + +func (v *NullableVlanVirtualCircuitCreateInput) Set(val *VlanVirtualCircuitCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVlanVirtualCircuitCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVlanVirtualCircuitCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVlanVirtualCircuitCreateInput(val *VlanVirtualCircuitCreateInput) *NullableVlanVirtualCircuitCreateInput { + return &NullableVlanVirtualCircuitCreateInput{value: val, isSet: true} +} + +func (v NullableVlanVirtualCircuitCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVlanVirtualCircuitCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_status.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_status.go new file mode 100644 index 00000000..7a74e6a1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_status.go @@ -0,0 +1,131 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VlanVirtualCircuitStatus The status of a Virtual Circuit is always 'pending' on creation. The status can turn to 'Waiting on Customer VLAN' if a Metro VLAN was not set yet on the Virtual Circuit and is the last step needed for full activation. For Dedicated interconnections, as long as the Dedicated Port has been associated to the Virtual Circuit and a NNI VNID has been set, it will turn to 'waiting_on_customer_vlan'. For Fabric VCs, it will only change to 'waiting_on_customer_vlan' once the corresponding Fabric connection has been found on the Fabric side. If the Fabric service token associated with the Virtual Circuit hasn't been redeemed on Fabric within the expiry time, it will change to an `expired` status. Once a Metro VLAN is set on the Virtual Circuit (which for Fabric VCs, can be set on creation of a Fabric VC) and the necessary set up is done, it will turn into 'Activating' status as it tries to activate the Virtual Circuit. Once the Virtual Circuit fully activates and is configured on the switch, it will turn to staus 'active'. For Fabric VCs (Metal Billed), we will start billing the moment the status of the Virtual Circuit turns to 'active'. If there are any changes to the VLAN after the Virtual Circuit is in an 'active' status, the status will show 'changing_vlan' if a new VLAN has been provided, or 'deactivating' if we are removing the VLAN. When a deletion request is issued for the Virtual Circuit, it will move to a 'deleting' status, and we will immediately unconfigure the switch for the Virtual Circuit and issue a deletion on any associated Fabric connections. Any associated Metro VLANs on the virtual circuit will also be unassociated after the switch has been successfully unconfigured. If there are any associated Fabric connections, we will only fully delete the Virtual Circuit once we have checked that the Fabric connection was fully deprovisioned on Fabric. +type VlanVirtualCircuitStatus string + +// List of VlanVirtualCircuit_status +const ( + VLANVIRTUALCIRCUITSTATUS_PENDING VlanVirtualCircuitStatus = "pending" + VLANVIRTUALCIRCUITSTATUS_WAITING_ON_CUSTOMER_VLAN VlanVirtualCircuitStatus = "waiting_on_customer_vlan" + VLANVIRTUALCIRCUITSTATUS_ACTIVATING VlanVirtualCircuitStatus = "activating" + VLANVIRTUALCIRCUITSTATUS_CHANGING_VLAN VlanVirtualCircuitStatus = "changing_vlan" + VLANVIRTUALCIRCUITSTATUS_DEACTIVATING VlanVirtualCircuitStatus = "deactivating" + VLANVIRTUALCIRCUITSTATUS_DELETING VlanVirtualCircuitStatus = "deleting" + VLANVIRTUALCIRCUITSTATUS_ACTIVE VlanVirtualCircuitStatus = "active" + VLANVIRTUALCIRCUITSTATUS_EXPIRED VlanVirtualCircuitStatus = "expired" + VLANVIRTUALCIRCUITSTATUS_ACTIVATION_FAILED VlanVirtualCircuitStatus = "activation_failed" + VLANVIRTUALCIRCUITSTATUS_CHANGING_VLAN_FAILED VlanVirtualCircuitStatus = "changing_vlan_failed" + VLANVIRTUALCIRCUITSTATUS_DEACTIVATION_FAILED VlanVirtualCircuitStatus = "deactivation_failed" + VLANVIRTUALCIRCUITSTATUS_DELETE_FAILED VlanVirtualCircuitStatus = "delete_failed" +) + +// All allowed values of VlanVirtualCircuitStatus enum +var AllowedVlanVirtualCircuitStatusEnumValues = []VlanVirtualCircuitStatus{ + "pending", + "waiting_on_customer_vlan", + "activating", + "changing_vlan", + "deactivating", + "deleting", + "active", + "expired", + "activation_failed", + "changing_vlan_failed", + "deactivation_failed", + "delete_failed", +} + +func (v *VlanVirtualCircuitStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VlanVirtualCircuitStatus(value) + for _, existing := range AllowedVlanVirtualCircuitStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid VlanVirtualCircuitStatus", value) +} + +// NewVlanVirtualCircuitStatusFromValue returns a pointer to a valid VlanVirtualCircuitStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVlanVirtualCircuitStatusFromValue(v string) (*VlanVirtualCircuitStatus, error) { + ev := VlanVirtualCircuitStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VlanVirtualCircuitStatus: valid values are %v", v, AllowedVlanVirtualCircuitStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VlanVirtualCircuitStatus) IsValid() bool { + for _, existing := range AllowedVlanVirtualCircuitStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VlanVirtualCircuit_status value +func (v VlanVirtualCircuitStatus) Ptr() *VlanVirtualCircuitStatus { + return &v +} + +type NullableVlanVirtualCircuitStatus struct { + value *VlanVirtualCircuitStatus + isSet bool +} + +func (v NullableVlanVirtualCircuitStatus) Get() *VlanVirtualCircuitStatus { + return v.value +} + +func (v *NullableVlanVirtualCircuitStatus) Set(val *VlanVirtualCircuitStatus) { + v.value = val + v.isSet = true +} + +func (v NullableVlanVirtualCircuitStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableVlanVirtualCircuitStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVlanVirtualCircuitStatus(val *VlanVirtualCircuitStatus) *NullableVlanVirtualCircuitStatus { + return &NullableVlanVirtualCircuitStatus{value: val, isSet: true} +} + +func (v NullableVlanVirtualCircuitStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVlanVirtualCircuitStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_type.go new file mode 100644 index 00000000..f7e9e280 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_type.go @@ -0,0 +1,109 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VlanVirtualCircuitType the model 'VlanVirtualCircuitType' +type VlanVirtualCircuitType string + +// List of VlanVirtualCircuit_type +const ( + VLANVIRTUALCIRCUITTYPE_VLAN VlanVirtualCircuitType = "vlan" +) + +// All allowed values of VlanVirtualCircuitType enum +var AllowedVlanVirtualCircuitTypeEnumValues = []VlanVirtualCircuitType{ + "vlan", +} + +func (v *VlanVirtualCircuitType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VlanVirtualCircuitType(value) + for _, existing := range AllowedVlanVirtualCircuitTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid VlanVirtualCircuitType", value) +} + +// NewVlanVirtualCircuitTypeFromValue returns a pointer to a valid VlanVirtualCircuitType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVlanVirtualCircuitTypeFromValue(v string) (*VlanVirtualCircuitType, error) { + ev := VlanVirtualCircuitType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VlanVirtualCircuitType: valid values are %v", v, AllowedVlanVirtualCircuitTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VlanVirtualCircuitType) IsValid() bool { + for _, existing := range AllowedVlanVirtualCircuitTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VlanVirtualCircuit_type value +func (v VlanVirtualCircuitType) Ptr() *VlanVirtualCircuitType { + return &v +} + +type NullableVlanVirtualCircuitType struct { + value *VlanVirtualCircuitType + isSet bool +} + +func (v NullableVlanVirtualCircuitType) Get() *VlanVirtualCircuitType { + return v.value +} + +func (v *NullableVlanVirtualCircuitType) Set(val *VlanVirtualCircuitType) { + v.value = val + v.isSet = true +} + +func (v NullableVlanVirtualCircuitType) IsSet() bool { + return v.isSet +} + +func (v *NullableVlanVirtualCircuitType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVlanVirtualCircuitType(val *VlanVirtualCircuitType) *NullableVlanVirtualCircuitType { + return &NullableVlanVirtualCircuitType{value: val, isSet: true} +} + +func (v NullableVlanVirtualCircuitType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVlanVirtualCircuitType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_update_input.go new file mode 100644 index 00000000..fa47b66d --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vlan_virtual_circuit_update_input.go @@ -0,0 +1,304 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the VlanVirtualCircuitUpdateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VlanVirtualCircuitUpdateInput{} + +// VlanVirtualCircuitUpdateInput struct for VlanVirtualCircuitUpdateInput +type VlanVirtualCircuitUpdateInput struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + // Speed can be changed only if it is an interconnection on a Dedicated Port + Speed *string `json:"speed,omitempty"` + Tags []string `json:"tags,omitempty"` + // A Virtual Network record UUID or the VNID of a Metro Virtual Network in your project. + Vnid *string `json:"vnid,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VlanVirtualCircuitUpdateInput VlanVirtualCircuitUpdateInput + +// NewVlanVirtualCircuitUpdateInput instantiates a new VlanVirtualCircuitUpdateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVlanVirtualCircuitUpdateInput() *VlanVirtualCircuitUpdateInput { + this := VlanVirtualCircuitUpdateInput{} + return &this +} + +// NewVlanVirtualCircuitUpdateInputWithDefaults instantiates a new VlanVirtualCircuitUpdateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVlanVirtualCircuitUpdateInputWithDefaults() *VlanVirtualCircuitUpdateInput { + this := VlanVirtualCircuitUpdateInput{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VlanVirtualCircuitUpdateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitUpdateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VlanVirtualCircuitUpdateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VlanVirtualCircuitUpdateInput) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VlanVirtualCircuitUpdateInput) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitUpdateInput) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *VlanVirtualCircuitUpdateInput) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VlanVirtualCircuitUpdateInput) SetName(v string) { + o.Name = &v +} + +// GetSpeed returns the Speed field value if set, zero value otherwise. +func (o *VlanVirtualCircuitUpdateInput) GetSpeed() string { + if o == nil || IsNil(o.Speed) { + var ret string + return ret + } + return *o.Speed +} + +// GetSpeedOk returns a tuple with the Speed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitUpdateInput) GetSpeedOk() (*string, bool) { + if o == nil || IsNil(o.Speed) { + return nil, false + } + return o.Speed, true +} + +// HasSpeed returns a boolean if a field has been set. +func (o *VlanVirtualCircuitUpdateInput) HasSpeed() bool { + if o != nil && !IsNil(o.Speed) { + return true + } + + return false +} + +// SetSpeed gets a reference to the given string and assigns it to the Speed field. +func (o *VlanVirtualCircuitUpdateInput) SetSpeed(v string) { + o.Speed = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VlanVirtualCircuitUpdateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitUpdateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VlanVirtualCircuitUpdateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VlanVirtualCircuitUpdateInput) SetTags(v []string) { + o.Tags = v +} + +// GetVnid returns the Vnid field value if set, zero value otherwise. +func (o *VlanVirtualCircuitUpdateInput) GetVnid() string { + if o == nil || IsNil(o.Vnid) { + var ret string + return ret + } + return *o.Vnid +} + +// GetVnidOk returns a tuple with the Vnid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VlanVirtualCircuitUpdateInput) GetVnidOk() (*string, bool) { + if o == nil || IsNil(o.Vnid) { + return nil, false + } + return o.Vnid, true +} + +// HasVnid returns a boolean if a field has been set. +func (o *VlanVirtualCircuitUpdateInput) HasVnid() bool { + if o != nil && !IsNil(o.Vnid) { + return true + } + + return false +} + +// SetVnid gets a reference to the given string and assigns it to the Vnid field. +func (o *VlanVirtualCircuitUpdateInput) SetVnid(v string) { + o.Vnid = &v +} + +func (o VlanVirtualCircuitUpdateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VlanVirtualCircuitUpdateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Speed) { + toSerialize["speed"] = o.Speed + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Vnid) { + toSerialize["vnid"] = o.Vnid + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VlanVirtualCircuitUpdateInput) UnmarshalJSON(data []byte) (err error) { + varVlanVirtualCircuitUpdateInput := _VlanVirtualCircuitUpdateInput{} + + err = json.Unmarshal(data, &varVlanVirtualCircuitUpdateInput) + + if err != nil { + return err + } + + *o = VlanVirtualCircuitUpdateInput(varVlanVirtualCircuitUpdateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "name") + delete(additionalProperties, "speed") + delete(additionalProperties, "tags") + delete(additionalProperties, "vnid") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVlanVirtualCircuitUpdateInput struct { + value *VlanVirtualCircuitUpdateInput + isSet bool +} + +func (v NullableVlanVirtualCircuitUpdateInput) Get() *VlanVirtualCircuitUpdateInput { + return v.value +} + +func (v *NullableVlanVirtualCircuitUpdateInput) Set(val *VlanVirtualCircuitUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVlanVirtualCircuitUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVlanVirtualCircuitUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVlanVirtualCircuitUpdateInput(val *VlanVirtualCircuitUpdateInput) *NullableVlanVirtualCircuitUpdateInput { + return &NullableVlanVirtualCircuitUpdateInput{value: val, isSet: true} +} + +func (v NullableVlanVirtualCircuitUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVlanVirtualCircuitUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf.go new file mode 100644 index 00000000..023061f7 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf.go @@ -0,0 +1,759 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the Vrf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Vrf{} + +// Vrf struct for Vrf +type Vrf struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + // Optional field that can be set to describe the VRF + Description *string `json:"description,omitempty"` + // True if the VRF is being billed. Usage will start when the first VRF Virtual Circuit is active, and will only stop when the VRF has been deleted. + Bill *bool `json:"bill,omitempty"` + // Toggle to enable the dynamic bgp neighbors feature on the VRF + BgpDynamicNeighborsEnabled *bool `json:"bgp_dynamic_neighbors_enabled,omitempty"` + // Toggle to export the VRF route-map to the dynamic bgp neighbors + BgpDynamicNeighborsExportRouteMap *bool `json:"bgp_dynamic_neighbors_export_route_map,omitempty"` + // Toggle BFD on dynamic bgp neighbors sessions + BgpDynamicNeighborsBfdEnabled *bool `json:"bgp_dynamic_neighbors_bfd_enabled,omitempty"` + // A 4-byte ASN associated with the VRF. + LocalAsn *int32 `json:"local_asn,omitempty"` + // Virtual circuits that are in the VRF + VirtualCircuits []VrfVirtualCircuit `json:"virtual_circuits,omitempty"` + // A list of CIDR network addresses. Like [\"10.0.0.0/16\", \"2001:d78::/56\"]. + IpRanges []string `json:"ip_ranges,omitempty"` + Project *Project `json:"project,omitempty"` + Metro *Metro `json:"metro,omitempty"` + CreatedBy *User `json:"created_by,omitempty"` + Href *string `json:"href,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Vrf Vrf + +// NewVrf instantiates a new Vrf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrf() *Vrf { + this := Vrf{} + var bill bool = false + this.Bill = &bill + return &this +} + +// NewVrfWithDefaults instantiates a new Vrf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfWithDefaults() *Vrf { + this := Vrf{} + var bill bool = false + this.Bill = &bill + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Vrf) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Vrf) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Vrf) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Vrf) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Vrf) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Vrf) SetName(v string) { + o.Name = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Vrf) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Vrf) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Vrf) SetDescription(v string) { + o.Description = &v +} + +// GetBill returns the Bill field value if set, zero value otherwise. +func (o *Vrf) GetBill() bool { + if o == nil || IsNil(o.Bill) { + var ret bool + return ret + } + return *o.Bill +} + +// GetBillOk returns a tuple with the Bill field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetBillOk() (*bool, bool) { + if o == nil || IsNil(o.Bill) { + return nil, false + } + return o.Bill, true +} + +// HasBill returns a boolean if a field has been set. +func (o *Vrf) HasBill() bool { + if o != nil && !IsNil(o.Bill) { + return true + } + + return false +} + +// SetBill gets a reference to the given bool and assigns it to the Bill field. +func (o *Vrf) SetBill(v bool) { + o.Bill = &v +} + +// GetBgpDynamicNeighborsEnabled returns the BgpDynamicNeighborsEnabled field value if set, zero value otherwise. +func (o *Vrf) GetBgpDynamicNeighborsEnabled() bool { + if o == nil || IsNil(o.BgpDynamicNeighborsEnabled) { + var ret bool + return ret + } + return *o.BgpDynamicNeighborsEnabled +} + +// GetBgpDynamicNeighborsEnabledOk returns a tuple with the BgpDynamicNeighborsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetBgpDynamicNeighborsEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.BgpDynamicNeighborsEnabled) { + return nil, false + } + return o.BgpDynamicNeighborsEnabled, true +} + +// HasBgpDynamicNeighborsEnabled returns a boolean if a field has been set. +func (o *Vrf) HasBgpDynamicNeighborsEnabled() bool { + if o != nil && !IsNil(o.BgpDynamicNeighborsEnabled) { + return true + } + + return false +} + +// SetBgpDynamicNeighborsEnabled gets a reference to the given bool and assigns it to the BgpDynamicNeighborsEnabled field. +func (o *Vrf) SetBgpDynamicNeighborsEnabled(v bool) { + o.BgpDynamicNeighborsEnabled = &v +} + +// GetBgpDynamicNeighborsExportRouteMap returns the BgpDynamicNeighborsExportRouteMap field value if set, zero value otherwise. +func (o *Vrf) GetBgpDynamicNeighborsExportRouteMap() bool { + if o == nil || IsNil(o.BgpDynamicNeighborsExportRouteMap) { + var ret bool + return ret + } + return *o.BgpDynamicNeighborsExportRouteMap +} + +// GetBgpDynamicNeighborsExportRouteMapOk returns a tuple with the BgpDynamicNeighborsExportRouteMap field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetBgpDynamicNeighborsExportRouteMapOk() (*bool, bool) { + if o == nil || IsNil(o.BgpDynamicNeighborsExportRouteMap) { + return nil, false + } + return o.BgpDynamicNeighborsExportRouteMap, true +} + +// HasBgpDynamicNeighborsExportRouteMap returns a boolean if a field has been set. +func (o *Vrf) HasBgpDynamicNeighborsExportRouteMap() bool { + if o != nil && !IsNil(o.BgpDynamicNeighborsExportRouteMap) { + return true + } + + return false +} + +// SetBgpDynamicNeighborsExportRouteMap gets a reference to the given bool and assigns it to the BgpDynamicNeighborsExportRouteMap field. +func (o *Vrf) SetBgpDynamicNeighborsExportRouteMap(v bool) { + o.BgpDynamicNeighborsExportRouteMap = &v +} + +// GetBgpDynamicNeighborsBfdEnabled returns the BgpDynamicNeighborsBfdEnabled field value if set, zero value otherwise. +func (o *Vrf) GetBgpDynamicNeighborsBfdEnabled() bool { + if o == nil || IsNil(o.BgpDynamicNeighborsBfdEnabled) { + var ret bool + return ret + } + return *o.BgpDynamicNeighborsBfdEnabled +} + +// GetBgpDynamicNeighborsBfdEnabledOk returns a tuple with the BgpDynamicNeighborsBfdEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetBgpDynamicNeighborsBfdEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.BgpDynamicNeighborsBfdEnabled) { + return nil, false + } + return o.BgpDynamicNeighborsBfdEnabled, true +} + +// HasBgpDynamicNeighborsBfdEnabled returns a boolean if a field has been set. +func (o *Vrf) HasBgpDynamicNeighborsBfdEnabled() bool { + if o != nil && !IsNil(o.BgpDynamicNeighborsBfdEnabled) { + return true + } + + return false +} + +// SetBgpDynamicNeighborsBfdEnabled gets a reference to the given bool and assigns it to the BgpDynamicNeighborsBfdEnabled field. +func (o *Vrf) SetBgpDynamicNeighborsBfdEnabled(v bool) { + o.BgpDynamicNeighborsBfdEnabled = &v +} + +// GetLocalAsn returns the LocalAsn field value if set, zero value otherwise. +func (o *Vrf) GetLocalAsn() int32 { + if o == nil || IsNil(o.LocalAsn) { + var ret int32 + return ret + } + return *o.LocalAsn +} + +// GetLocalAsnOk returns a tuple with the LocalAsn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetLocalAsnOk() (*int32, bool) { + if o == nil || IsNil(o.LocalAsn) { + return nil, false + } + return o.LocalAsn, true +} + +// HasLocalAsn returns a boolean if a field has been set. +func (o *Vrf) HasLocalAsn() bool { + if o != nil && !IsNil(o.LocalAsn) { + return true + } + + return false +} + +// SetLocalAsn gets a reference to the given int32 and assigns it to the LocalAsn field. +func (o *Vrf) SetLocalAsn(v int32) { + o.LocalAsn = &v +} + +// GetVirtualCircuits returns the VirtualCircuits field value if set, zero value otherwise. +func (o *Vrf) GetVirtualCircuits() []VrfVirtualCircuit { + if o == nil || IsNil(o.VirtualCircuits) { + var ret []VrfVirtualCircuit + return ret + } + return o.VirtualCircuits +} + +// GetVirtualCircuitsOk returns a tuple with the VirtualCircuits field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetVirtualCircuitsOk() ([]VrfVirtualCircuit, bool) { + if o == nil || IsNil(o.VirtualCircuits) { + return nil, false + } + return o.VirtualCircuits, true +} + +// HasVirtualCircuits returns a boolean if a field has been set. +func (o *Vrf) HasVirtualCircuits() bool { + if o != nil && !IsNil(o.VirtualCircuits) { + return true + } + + return false +} + +// SetVirtualCircuits gets a reference to the given []VrfVirtualCircuit and assigns it to the VirtualCircuits field. +func (o *Vrf) SetVirtualCircuits(v []VrfVirtualCircuit) { + o.VirtualCircuits = v +} + +// GetIpRanges returns the IpRanges field value if set, zero value otherwise. +func (o *Vrf) GetIpRanges() []string { + if o == nil || IsNil(o.IpRanges) { + var ret []string + return ret + } + return o.IpRanges +} + +// GetIpRangesOk returns a tuple with the IpRanges field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetIpRangesOk() ([]string, bool) { + if o == nil || IsNil(o.IpRanges) { + return nil, false + } + return o.IpRanges, true +} + +// HasIpRanges returns a boolean if a field has been set. +func (o *Vrf) HasIpRanges() bool { + if o != nil && !IsNil(o.IpRanges) { + return true + } + + return false +} + +// SetIpRanges gets a reference to the given []string and assigns it to the IpRanges field. +func (o *Vrf) SetIpRanges(v []string) { + o.IpRanges = v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *Vrf) GetProject() Project { + if o == nil || IsNil(o.Project) { + var ret Project + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetProjectOk() (*Project, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *Vrf) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Project and assigns it to the Project field. +func (o *Vrf) SetProject(v Project) { + o.Project = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *Vrf) GetMetro() Metro { + if o == nil || IsNil(o.Metro) { + var ret Metro + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetMetroOk() (*Metro, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *Vrf) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given Metro and assigns it to the Metro field. +func (o *Vrf) SetMetro(v Metro) { + o.Metro = &v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *Vrf) GetCreatedBy() User { + if o == nil || IsNil(o.CreatedBy) { + var ret User + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetCreatedByOk() (*User, bool) { + if o == nil || IsNil(o.CreatedBy) { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *Vrf) HasCreatedBy() bool { + if o != nil && !IsNil(o.CreatedBy) { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given User and assigns it to the CreatedBy field. +func (o *Vrf) SetCreatedBy(v User) { + o.CreatedBy = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Vrf) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *Vrf) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Vrf) SetHref(v string) { + o.Href = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Vrf) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Vrf) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Vrf) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Vrf) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Vrf) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Vrf) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Vrf) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Vrf) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *Vrf) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *Vrf) SetTags(v []string) { + o.Tags = v +} + +func (o Vrf) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Vrf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Bill) { + toSerialize["bill"] = o.Bill + } + if !IsNil(o.BgpDynamicNeighborsEnabled) { + toSerialize["bgp_dynamic_neighbors_enabled"] = o.BgpDynamicNeighborsEnabled + } + if !IsNil(o.BgpDynamicNeighborsExportRouteMap) { + toSerialize["bgp_dynamic_neighbors_export_route_map"] = o.BgpDynamicNeighborsExportRouteMap + } + if !IsNil(o.BgpDynamicNeighborsBfdEnabled) { + toSerialize["bgp_dynamic_neighbors_bfd_enabled"] = o.BgpDynamicNeighborsBfdEnabled + } + if !IsNil(o.LocalAsn) { + toSerialize["local_asn"] = o.LocalAsn + } + if !IsNil(o.VirtualCircuits) { + toSerialize["virtual_circuits"] = o.VirtualCircuits + } + if !IsNil(o.IpRanges) { + toSerialize["ip_ranges"] = o.IpRanges + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + if !IsNil(o.CreatedBy) { + toSerialize["created_by"] = o.CreatedBy + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Vrf) UnmarshalJSON(data []byte) (err error) { + varVrf := _Vrf{} + + err = json.Unmarshal(data, &varVrf) + + if err != nil { + return err + } + + *o = Vrf(varVrf) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "description") + delete(additionalProperties, "bill") + delete(additionalProperties, "bgp_dynamic_neighbors_enabled") + delete(additionalProperties, "bgp_dynamic_neighbors_export_route_map") + delete(additionalProperties, "bgp_dynamic_neighbors_bfd_enabled") + delete(additionalProperties, "local_asn") + delete(additionalProperties, "virtual_circuits") + delete(additionalProperties, "ip_ranges") + delete(additionalProperties, "project") + delete(additionalProperties, "metro") + delete(additionalProperties, "created_by") + delete(additionalProperties, "href") + delete(additionalProperties, "created_at") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrf struct { + value *Vrf + isSet bool +} + +func (v NullableVrf) Get() *Vrf { + return v.value +} + +func (v *NullableVrf) Set(val *Vrf) { + v.value = val + v.isSet = true +} + +func (v NullableVrf) IsSet() bool { + return v.isSet +} + +func (v *NullableVrf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrf(val *Vrf) *NullableVrf { + return &NullableVrf{value: val, isSet: true} +} + +func (v NullableVrf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_create_input.go new file mode 100644 index 00000000..5b2ba93a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_create_input.go @@ -0,0 +1,460 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the VrfCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfCreateInput{} + +// VrfCreateInput struct for VrfCreateInput +type VrfCreateInput struct { + // Toggle to enable the dynamic bgp neighbors feature on the VRF + BgpDynamicNeighborsEnabled *bool `json:"bgp_dynamic_neighbors_enabled,omitempty"` + // Toggle to export the VRF route-map to the dynamic bgp neighbors + BgpDynamicNeighborsExportRouteMap *bool `json:"bgp_dynamic_neighbors_export_route_map,omitempty"` + // Toggle BFD on dynamic bgp neighbors sessions + BgpDynamicNeighborsBfdEnabled *bool `json:"bgp_dynamic_neighbors_bfd_enabled,omitempty"` + Description *string `json:"description,omitempty"` + // A list of CIDR network addresses. Like [\"10.0.0.0/16\", \"2001:d78::/56\"]. IPv4 blocks must be between /8 and /29 in size. IPv6 blocks must be between /56 and /64. A VRF\\'s IP ranges must be defined in order to create VRF IP Reservations, which can then be used for Metal Gateways or Virtual Circuits. + IpRanges []string `json:"ip_ranges,omitempty"` + LocalAsn *int32 `json:"local_asn,omitempty"` + // The UUID (or metro code) for the Metro in which to create this VRF. + Metro string `json:"metro"` + Name string `json:"name"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfCreateInput VrfCreateInput + +// NewVrfCreateInput instantiates a new VrfCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfCreateInput(metro string, name string) *VrfCreateInput { + this := VrfCreateInput{} + this.Metro = metro + this.Name = name + return &this +} + +// NewVrfCreateInputWithDefaults instantiates a new VrfCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfCreateInputWithDefaults() *VrfCreateInput { + this := VrfCreateInput{} + return &this +} + +// GetBgpDynamicNeighborsEnabled returns the BgpDynamicNeighborsEnabled field value if set, zero value otherwise. +func (o *VrfCreateInput) GetBgpDynamicNeighborsEnabled() bool { + if o == nil || IsNil(o.BgpDynamicNeighborsEnabled) { + var ret bool + return ret + } + return *o.BgpDynamicNeighborsEnabled +} + +// GetBgpDynamicNeighborsEnabledOk returns a tuple with the BgpDynamicNeighborsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfCreateInput) GetBgpDynamicNeighborsEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.BgpDynamicNeighborsEnabled) { + return nil, false + } + return o.BgpDynamicNeighborsEnabled, true +} + +// HasBgpDynamicNeighborsEnabled returns a boolean if a field has been set. +func (o *VrfCreateInput) HasBgpDynamicNeighborsEnabled() bool { + if o != nil && !IsNil(o.BgpDynamicNeighborsEnabled) { + return true + } + + return false +} + +// SetBgpDynamicNeighborsEnabled gets a reference to the given bool and assigns it to the BgpDynamicNeighborsEnabled field. +func (o *VrfCreateInput) SetBgpDynamicNeighborsEnabled(v bool) { + o.BgpDynamicNeighborsEnabled = &v +} + +// GetBgpDynamicNeighborsExportRouteMap returns the BgpDynamicNeighborsExportRouteMap field value if set, zero value otherwise. +func (o *VrfCreateInput) GetBgpDynamicNeighborsExportRouteMap() bool { + if o == nil || IsNil(o.BgpDynamicNeighborsExportRouteMap) { + var ret bool + return ret + } + return *o.BgpDynamicNeighborsExportRouteMap +} + +// GetBgpDynamicNeighborsExportRouteMapOk returns a tuple with the BgpDynamicNeighborsExportRouteMap field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfCreateInput) GetBgpDynamicNeighborsExportRouteMapOk() (*bool, bool) { + if o == nil || IsNil(o.BgpDynamicNeighborsExportRouteMap) { + return nil, false + } + return o.BgpDynamicNeighborsExportRouteMap, true +} + +// HasBgpDynamicNeighborsExportRouteMap returns a boolean if a field has been set. +func (o *VrfCreateInput) HasBgpDynamicNeighborsExportRouteMap() bool { + if o != nil && !IsNil(o.BgpDynamicNeighborsExportRouteMap) { + return true + } + + return false +} + +// SetBgpDynamicNeighborsExportRouteMap gets a reference to the given bool and assigns it to the BgpDynamicNeighborsExportRouteMap field. +func (o *VrfCreateInput) SetBgpDynamicNeighborsExportRouteMap(v bool) { + o.BgpDynamicNeighborsExportRouteMap = &v +} + +// GetBgpDynamicNeighborsBfdEnabled returns the BgpDynamicNeighborsBfdEnabled field value if set, zero value otherwise. +func (o *VrfCreateInput) GetBgpDynamicNeighborsBfdEnabled() bool { + if o == nil || IsNil(o.BgpDynamicNeighborsBfdEnabled) { + var ret bool + return ret + } + return *o.BgpDynamicNeighborsBfdEnabled +} + +// GetBgpDynamicNeighborsBfdEnabledOk returns a tuple with the BgpDynamicNeighborsBfdEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfCreateInput) GetBgpDynamicNeighborsBfdEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.BgpDynamicNeighborsBfdEnabled) { + return nil, false + } + return o.BgpDynamicNeighborsBfdEnabled, true +} + +// HasBgpDynamicNeighborsBfdEnabled returns a boolean if a field has been set. +func (o *VrfCreateInput) HasBgpDynamicNeighborsBfdEnabled() bool { + if o != nil && !IsNil(o.BgpDynamicNeighborsBfdEnabled) { + return true + } + + return false +} + +// SetBgpDynamicNeighborsBfdEnabled gets a reference to the given bool and assigns it to the BgpDynamicNeighborsBfdEnabled field. +func (o *VrfCreateInput) SetBgpDynamicNeighborsBfdEnabled(v bool) { + o.BgpDynamicNeighborsBfdEnabled = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VrfCreateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfCreateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VrfCreateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VrfCreateInput) SetDescription(v string) { + o.Description = &v +} + +// GetIpRanges returns the IpRanges field value if set, zero value otherwise. +func (o *VrfCreateInput) GetIpRanges() []string { + if o == nil || IsNil(o.IpRanges) { + var ret []string + return ret + } + return o.IpRanges +} + +// GetIpRangesOk returns a tuple with the IpRanges field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfCreateInput) GetIpRangesOk() ([]string, bool) { + if o == nil || IsNil(o.IpRanges) { + return nil, false + } + return o.IpRanges, true +} + +// HasIpRanges returns a boolean if a field has been set. +func (o *VrfCreateInput) HasIpRanges() bool { + if o != nil && !IsNil(o.IpRanges) { + return true + } + + return false +} + +// SetIpRanges gets a reference to the given []string and assigns it to the IpRanges field. +func (o *VrfCreateInput) SetIpRanges(v []string) { + o.IpRanges = v +} + +// GetLocalAsn returns the LocalAsn field value if set, zero value otherwise. +func (o *VrfCreateInput) GetLocalAsn() int32 { + if o == nil || IsNil(o.LocalAsn) { + var ret int32 + return ret + } + return *o.LocalAsn +} + +// GetLocalAsnOk returns a tuple with the LocalAsn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfCreateInput) GetLocalAsnOk() (*int32, bool) { + if o == nil || IsNil(o.LocalAsn) { + return nil, false + } + return o.LocalAsn, true +} + +// HasLocalAsn returns a boolean if a field has been set. +func (o *VrfCreateInput) HasLocalAsn() bool { + if o != nil && !IsNil(o.LocalAsn) { + return true + } + + return false +} + +// SetLocalAsn gets a reference to the given int32 and assigns it to the LocalAsn field. +func (o *VrfCreateInput) SetLocalAsn(v int32) { + o.LocalAsn = &v +} + +// GetMetro returns the Metro field value +func (o *VrfCreateInput) GetMetro() string { + if o == nil { + var ret string + return ret + } + + return o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value +// and a boolean to check if the value has been set. +func (o *VrfCreateInput) GetMetroOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metro, true +} + +// SetMetro sets field value +func (o *VrfCreateInput) SetMetro(v string) { + o.Metro = v +} + +// GetName returns the Name field value +func (o *VrfCreateInput) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *VrfCreateInput) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *VrfCreateInput) SetName(v string) { + o.Name = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VrfCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VrfCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VrfCreateInput) SetTags(v []string) { + o.Tags = v +} + +func (o VrfCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BgpDynamicNeighborsEnabled) { + toSerialize["bgp_dynamic_neighbors_enabled"] = o.BgpDynamicNeighborsEnabled + } + if !IsNil(o.BgpDynamicNeighborsExportRouteMap) { + toSerialize["bgp_dynamic_neighbors_export_route_map"] = o.BgpDynamicNeighborsExportRouteMap + } + if !IsNil(o.BgpDynamicNeighborsBfdEnabled) { + toSerialize["bgp_dynamic_neighbors_bfd_enabled"] = o.BgpDynamicNeighborsBfdEnabled + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.IpRanges) { + toSerialize["ip_ranges"] = o.IpRanges + } + if !IsNil(o.LocalAsn) { + toSerialize["local_asn"] = o.LocalAsn + } + toSerialize["metro"] = o.Metro + toSerialize["name"] = o.Name + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "metro", + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVrfCreateInput := _VrfCreateInput{} + + err = json.Unmarshal(data, &varVrfCreateInput) + + if err != nil { + return err + } + + *o = VrfCreateInput(varVrfCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bgp_dynamic_neighbors_enabled") + delete(additionalProperties, "bgp_dynamic_neighbors_export_route_map") + delete(additionalProperties, "bgp_dynamic_neighbors_bfd_enabled") + delete(additionalProperties, "description") + delete(additionalProperties, "ip_ranges") + delete(additionalProperties, "local_asn") + delete(additionalProperties, "metro") + delete(additionalProperties, "name") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfCreateInput struct { + value *VrfCreateInput + isSet bool +} + +func (v NullableVrfCreateInput) Get() *VrfCreateInput { + return v.value +} + +func (v *NullableVrfCreateInput) Set(val *VrfCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVrfCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfCreateInput(val *VrfCreateInput) *NullableVrfCreateInput { + return &NullableVrfCreateInput{value: val, isSet: true} +} + +func (v NullableVrfCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_fabric_vc_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_fabric_vc_create_input.go new file mode 100644 index 00000000..47b2f5e4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_fabric_vc_create_input.go @@ -0,0 +1,502 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the VrfFabricVcCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfFabricVcCreateInput{} + +// VrfFabricVcCreateInput struct for VrfFabricVcCreateInput +type VrfFabricVcCreateInput struct { + // The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key. + ContactEmail *string `json:"contact_email,omitempty"` + Description *string `json:"description,omitempty"` + // A Metro ID or code. When creating Fabric VCs (Metal Billed), this is where interconnection will be originating from, as we pre-authorize the use of one of our shared ports as the origin of the interconnection using A-Side service tokens. We only allow local connections for Fabric VCs (Metal Billed), so the destination location must be the same as the origin. For Fabric VCs (Fabric Billed), or shared connections, this will be the destination of the interconnection. We allow remote connections for Fabric VCs (Fabric Billed), so the origin of the interconnection can be a different metro set here. + Metro string `json:"metro"` + Name string `json:"name"` + Project *string `json:"project,omitempty"` + // Either 'primary' or 'redundant'. + Redundancy string `json:"redundancy"` + ServiceTokenType VlanFabricVcCreateInputServiceTokenType `json:"service_token_type"` + // A interconnection speed, in bps, mbps, or gbps. For Fabric VCs, this represents the maximum speed of the interconnection. For Fabric VCs (Metal Billed), this can only be one of the following: ''50mbps'', ''200mbps'', ''500mbps'', ''1gbps'', ''2gbps'', ''5gbps'' or ''10gbps'', and is required for creation. For Fabric VCs (Fabric Billed), this field will always default to ''10gbps'' even if it is not provided. For example, ''500000000'', ''50m'', or' ''500mbps'' will all work as valid inputs. + Speed *int64 `json:"speed,omitempty"` + Tags []string `json:"tags,omitempty"` + Type VlanFabricVcCreateInputType `json:"type"` + // This field holds a list of VRF UUIDs that will be set automatically on the virtual circuits of Fabric VCs on creation, and can hold up to two UUIDs. Two UUIDs are required when requesting redundant Fabric VCs. The first UUID will be set on the primary virtual circuit, while the second UUID will be set on the secondary. The two UUIDs can be the same if both the primary and secondary virtual circuits will be in the same VRF. This parameter is included in the specification as a developer preview and is generally unavailable. Please contact our Support team for more details. + Vrfs []string `json:"vrfs"` + AdditionalProperties map[string]interface{} +} + +type _VrfFabricVcCreateInput VrfFabricVcCreateInput + +// NewVrfFabricVcCreateInput instantiates a new VrfFabricVcCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfFabricVcCreateInput(metro string, name string, redundancy string, serviceTokenType VlanFabricVcCreateInputServiceTokenType, type_ VlanFabricVcCreateInputType, vrfs []string) *VrfFabricVcCreateInput { + this := VrfFabricVcCreateInput{} + this.Metro = metro + this.Name = name + this.Redundancy = redundancy + this.ServiceTokenType = serviceTokenType + this.Type = type_ + this.Vrfs = vrfs + return &this +} + +// NewVrfFabricVcCreateInputWithDefaults instantiates a new VrfFabricVcCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfFabricVcCreateInputWithDefaults() *VrfFabricVcCreateInput { + this := VrfFabricVcCreateInput{} + return &this +} + +// GetContactEmail returns the ContactEmail field value if set, zero value otherwise. +func (o *VrfFabricVcCreateInput) GetContactEmail() string { + if o == nil || IsNil(o.ContactEmail) { + var ret string + return ret + } + return *o.ContactEmail +} + +// GetContactEmailOk returns a tuple with the ContactEmail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfFabricVcCreateInput) GetContactEmailOk() (*string, bool) { + if o == nil || IsNil(o.ContactEmail) { + return nil, false + } + return o.ContactEmail, true +} + +// HasContactEmail returns a boolean if a field has been set. +func (o *VrfFabricVcCreateInput) HasContactEmail() bool { + if o != nil && !IsNil(o.ContactEmail) { + return true + } + + return false +} + +// SetContactEmail gets a reference to the given string and assigns it to the ContactEmail field. +func (o *VrfFabricVcCreateInput) SetContactEmail(v string) { + o.ContactEmail = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VrfFabricVcCreateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfFabricVcCreateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VrfFabricVcCreateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VrfFabricVcCreateInput) SetDescription(v string) { + o.Description = &v +} + +// GetMetro returns the Metro field value +func (o *VrfFabricVcCreateInput) GetMetro() string { + if o == nil { + var ret string + return ret + } + + return o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value +// and a boolean to check if the value has been set. +func (o *VrfFabricVcCreateInput) GetMetroOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metro, true +} + +// SetMetro sets field value +func (o *VrfFabricVcCreateInput) SetMetro(v string) { + o.Metro = v +} + +// GetName returns the Name field value +func (o *VrfFabricVcCreateInput) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *VrfFabricVcCreateInput) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *VrfFabricVcCreateInput) SetName(v string) { + o.Name = v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *VrfFabricVcCreateInput) GetProject() string { + if o == nil || IsNil(o.Project) { + var ret string + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfFabricVcCreateInput) GetProjectOk() (*string, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *VrfFabricVcCreateInput) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given string and assigns it to the Project field. +func (o *VrfFabricVcCreateInput) SetProject(v string) { + o.Project = &v +} + +// GetRedundancy returns the Redundancy field value +func (o *VrfFabricVcCreateInput) GetRedundancy() string { + if o == nil { + var ret string + return ret + } + + return o.Redundancy +} + +// GetRedundancyOk returns a tuple with the Redundancy field value +// and a boolean to check if the value has been set. +func (o *VrfFabricVcCreateInput) GetRedundancyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Redundancy, true +} + +// SetRedundancy sets field value +func (o *VrfFabricVcCreateInput) SetRedundancy(v string) { + o.Redundancy = v +} + +// GetServiceTokenType returns the ServiceTokenType field value +func (o *VrfFabricVcCreateInput) GetServiceTokenType() VlanFabricVcCreateInputServiceTokenType { + if o == nil { + var ret VlanFabricVcCreateInputServiceTokenType + return ret + } + + return o.ServiceTokenType +} + +// GetServiceTokenTypeOk returns a tuple with the ServiceTokenType field value +// and a boolean to check if the value has been set. +func (o *VrfFabricVcCreateInput) GetServiceTokenTypeOk() (*VlanFabricVcCreateInputServiceTokenType, bool) { + if o == nil { + return nil, false + } + return &o.ServiceTokenType, true +} + +// SetServiceTokenType sets field value +func (o *VrfFabricVcCreateInput) SetServiceTokenType(v VlanFabricVcCreateInputServiceTokenType) { + o.ServiceTokenType = v +} + +// GetSpeed returns the Speed field value if set, zero value otherwise. +func (o *VrfFabricVcCreateInput) GetSpeed() int64 { + if o == nil || IsNil(o.Speed) { + var ret int64 + return ret + } + return *o.Speed +} + +// GetSpeedOk returns a tuple with the Speed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfFabricVcCreateInput) GetSpeedOk() (*int64, bool) { + if o == nil || IsNil(o.Speed) { + return nil, false + } + return o.Speed, true +} + +// HasSpeed returns a boolean if a field has been set. +func (o *VrfFabricVcCreateInput) HasSpeed() bool { + if o != nil && !IsNil(o.Speed) { + return true + } + + return false +} + +// SetSpeed gets a reference to the given int64 and assigns it to the Speed field. +func (o *VrfFabricVcCreateInput) SetSpeed(v int64) { + o.Speed = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VrfFabricVcCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfFabricVcCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VrfFabricVcCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VrfFabricVcCreateInput) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value +func (o *VrfFabricVcCreateInput) GetType() VlanFabricVcCreateInputType { + if o == nil { + var ret VlanFabricVcCreateInputType + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *VrfFabricVcCreateInput) GetTypeOk() (*VlanFabricVcCreateInputType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *VrfFabricVcCreateInput) SetType(v VlanFabricVcCreateInputType) { + o.Type = v +} + +// GetVrfs returns the Vrfs field value +func (o *VrfFabricVcCreateInput) GetVrfs() []string { + if o == nil { + var ret []string + return ret + } + + return o.Vrfs +} + +// GetVrfsOk returns a tuple with the Vrfs field value +// and a boolean to check if the value has been set. +func (o *VrfFabricVcCreateInput) GetVrfsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Vrfs, true +} + +// SetVrfs sets field value +func (o *VrfFabricVcCreateInput) SetVrfs(v []string) { + o.Vrfs = v +} + +func (o VrfFabricVcCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfFabricVcCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ContactEmail) { + toSerialize["contact_email"] = o.ContactEmail + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["metro"] = o.Metro + toSerialize["name"] = o.Name + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + toSerialize["redundancy"] = o.Redundancy + toSerialize["service_token_type"] = o.ServiceTokenType + if !IsNil(o.Speed) { + toSerialize["speed"] = o.Speed + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + toSerialize["type"] = o.Type + toSerialize["vrfs"] = o.Vrfs + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfFabricVcCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "metro", + "name", + "redundancy", + "service_token_type", + "type", + "vrfs", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVrfFabricVcCreateInput := _VrfFabricVcCreateInput{} + + err = json.Unmarshal(data, &varVrfFabricVcCreateInput) + + if err != nil { + return err + } + + *o = VrfFabricVcCreateInput(varVrfFabricVcCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "contact_email") + delete(additionalProperties, "description") + delete(additionalProperties, "metro") + delete(additionalProperties, "name") + delete(additionalProperties, "project") + delete(additionalProperties, "redundancy") + delete(additionalProperties, "service_token_type") + delete(additionalProperties, "speed") + delete(additionalProperties, "tags") + delete(additionalProperties, "type") + delete(additionalProperties, "vrfs") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfFabricVcCreateInput struct { + value *VrfFabricVcCreateInput + isSet bool +} + +func (v NullableVrfFabricVcCreateInput) Get() *VrfFabricVcCreateInput { + return v.value +} + +func (v *NullableVrfFabricVcCreateInput) Set(val *VrfFabricVcCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVrfFabricVcCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfFabricVcCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfFabricVcCreateInput(val *VrfFabricVcCreateInput) *NullableVrfFabricVcCreateInput { + return &NullableVrfFabricVcCreateInput{value: val, isSet: true} +} + +func (v NullableVrfFabricVcCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfFabricVcCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation.go new file mode 100644 index 00000000..7eb93c04 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation.go @@ -0,0 +1,1011 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the VrfIpReservation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfIpReservation{} + +// VrfIpReservation struct for VrfIpReservation +type VrfIpReservation struct { + AddressFamily *int32 `json:"address_family,omitempty"` + Cidr *int32 `json:"cidr,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + CreatedBy *Href `json:"created_by,omitempty"` + Details *string `json:"details,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + MetalGateway *MetalGatewayLite `json:"metal_gateway,omitempty"` + Netmask *string `json:"netmask,omitempty"` + Network *string `json:"network,omitempty"` + Project *Project `json:"project,omitempty"` + State *string `json:"state,omitempty"` + Tags []string `json:"tags,omitempty"` + Type VrfIpReservationType `json:"type"` + Vrf Vrf `json:"vrf"` + Public *bool `json:"public,omitempty"` + Management *bool `json:"management,omitempty"` + Manageable *bool `json:"manageable,omitempty"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Bill *bool `json:"bill,omitempty"` + ProjectLite *Project `json:"project_lite,omitempty"` + Address *string `json:"address,omitempty"` + Gateway *string `json:"gateway,omitempty"` + Metro *Metro `json:"metro,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfIpReservation VrfIpReservation + +// NewVrfIpReservation instantiates a new VrfIpReservation object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfIpReservation(type_ VrfIpReservationType, vrf Vrf) *VrfIpReservation { + this := VrfIpReservation{} + this.Type = type_ + this.Vrf = vrf + return &this +} + +// NewVrfIpReservationWithDefaults instantiates a new VrfIpReservation object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfIpReservationWithDefaults() *VrfIpReservation { + this := VrfIpReservation{} + return &this +} + +// GetAddressFamily returns the AddressFamily field value if set, zero value otherwise. +func (o *VrfIpReservation) GetAddressFamily() int32 { + if o == nil || IsNil(o.AddressFamily) { + var ret int32 + return ret + } + return *o.AddressFamily +} + +// GetAddressFamilyOk returns a tuple with the AddressFamily field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetAddressFamilyOk() (*int32, bool) { + if o == nil || IsNil(o.AddressFamily) { + return nil, false + } + return o.AddressFamily, true +} + +// HasAddressFamily returns a boolean if a field has been set. +func (o *VrfIpReservation) HasAddressFamily() bool { + if o != nil && !IsNil(o.AddressFamily) { + return true + } + + return false +} + +// SetAddressFamily gets a reference to the given int32 and assigns it to the AddressFamily field. +func (o *VrfIpReservation) SetAddressFamily(v int32) { + o.AddressFamily = &v +} + +// GetCidr returns the Cidr field value if set, zero value otherwise. +func (o *VrfIpReservation) GetCidr() int32 { + if o == nil || IsNil(o.Cidr) { + var ret int32 + return ret + } + return *o.Cidr +} + +// GetCidrOk returns a tuple with the Cidr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetCidrOk() (*int32, bool) { + if o == nil || IsNil(o.Cidr) { + return nil, false + } + return o.Cidr, true +} + +// HasCidr returns a boolean if a field has been set. +func (o *VrfIpReservation) HasCidr() bool { + if o != nil && !IsNil(o.Cidr) { + return true + } + + return false +} + +// SetCidr gets a reference to the given int32 and assigns it to the Cidr field. +func (o *VrfIpReservation) SetCidr(v int32) { + o.Cidr = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *VrfIpReservation) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *VrfIpReservation) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *VrfIpReservation) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *VrfIpReservation) GetCreatedBy() Href { + if o == nil || IsNil(o.CreatedBy) { + var ret Href + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetCreatedByOk() (*Href, bool) { + if o == nil || IsNil(o.CreatedBy) { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *VrfIpReservation) HasCreatedBy() bool { + if o != nil && !IsNil(o.CreatedBy) { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given Href and assigns it to the CreatedBy field. +func (o *VrfIpReservation) SetCreatedBy(v Href) { + o.CreatedBy = &v +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *VrfIpReservation) GetDetails() string { + if o == nil || IsNil(o.Details) { + var ret string + return ret + } + return *o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetDetailsOk() (*string, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *VrfIpReservation) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *VrfIpReservation) SetDetails(v string) { + o.Details = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *VrfIpReservation) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *VrfIpReservation) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *VrfIpReservation) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *VrfIpReservation) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *VrfIpReservation) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *VrfIpReservation) SetId(v string) { + o.Id = &v +} + +// GetMetalGateway returns the MetalGateway field value if set, zero value otherwise. +func (o *VrfIpReservation) GetMetalGateway() MetalGatewayLite { + if o == nil || IsNil(o.MetalGateway) { + var ret MetalGatewayLite + return ret + } + return *o.MetalGateway +} + +// GetMetalGatewayOk returns a tuple with the MetalGateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetMetalGatewayOk() (*MetalGatewayLite, bool) { + if o == nil || IsNil(o.MetalGateway) { + return nil, false + } + return o.MetalGateway, true +} + +// HasMetalGateway returns a boolean if a field has been set. +func (o *VrfIpReservation) HasMetalGateway() bool { + if o != nil && !IsNil(o.MetalGateway) { + return true + } + + return false +} + +// SetMetalGateway gets a reference to the given MetalGatewayLite and assigns it to the MetalGateway field. +func (o *VrfIpReservation) SetMetalGateway(v MetalGatewayLite) { + o.MetalGateway = &v +} + +// GetNetmask returns the Netmask field value if set, zero value otherwise. +func (o *VrfIpReservation) GetNetmask() string { + if o == nil || IsNil(o.Netmask) { + var ret string + return ret + } + return *o.Netmask +} + +// GetNetmaskOk returns a tuple with the Netmask field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetNetmaskOk() (*string, bool) { + if o == nil || IsNil(o.Netmask) { + return nil, false + } + return o.Netmask, true +} + +// HasNetmask returns a boolean if a field has been set. +func (o *VrfIpReservation) HasNetmask() bool { + if o != nil && !IsNil(o.Netmask) { + return true + } + + return false +} + +// SetNetmask gets a reference to the given string and assigns it to the Netmask field. +func (o *VrfIpReservation) SetNetmask(v string) { + o.Netmask = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *VrfIpReservation) GetNetwork() string { + if o == nil || IsNil(o.Network) { + var ret string + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetNetworkOk() (*string, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *VrfIpReservation) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given string and assigns it to the Network field. +func (o *VrfIpReservation) SetNetwork(v string) { + o.Network = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *VrfIpReservation) GetProject() Project { + if o == nil || IsNil(o.Project) { + var ret Project + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetProjectOk() (*Project, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *VrfIpReservation) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Project and assigns it to the Project field. +func (o *VrfIpReservation) SetProject(v Project) { + o.Project = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *VrfIpReservation) GetState() string { + if o == nil || IsNil(o.State) { + var ret string + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetStateOk() (*string, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *VrfIpReservation) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *VrfIpReservation) SetState(v string) { + o.State = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VrfIpReservation) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VrfIpReservation) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VrfIpReservation) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value +func (o *VrfIpReservation) GetType() VrfIpReservationType { + if o == nil { + var ret VrfIpReservationType + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetTypeOk() (*VrfIpReservationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *VrfIpReservation) SetType(v VrfIpReservationType) { + o.Type = v +} + +// GetVrf returns the Vrf field value +func (o *VrfIpReservation) GetVrf() Vrf { + if o == nil { + var ret Vrf + return ret + } + + return o.Vrf +} + +// GetVrfOk returns a tuple with the Vrf field value +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetVrfOk() (*Vrf, bool) { + if o == nil { + return nil, false + } + return &o.Vrf, true +} + +// SetVrf sets field value +func (o *VrfIpReservation) SetVrf(v Vrf) { + o.Vrf = v +} + +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *VrfIpReservation) GetPublic() bool { + if o == nil || IsNil(o.Public) { + var ret bool + return ret + } + return *o.Public +} + +// GetPublicOk returns a tuple with the Public field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetPublicOk() (*bool, bool) { + if o == nil || IsNil(o.Public) { + return nil, false + } + return o.Public, true +} + +// HasPublic returns a boolean if a field has been set. +func (o *VrfIpReservation) HasPublic() bool { + if o != nil && !IsNil(o.Public) { + return true + } + + return false +} + +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *VrfIpReservation) SetPublic(v bool) { + o.Public = &v +} + +// GetManagement returns the Management field value if set, zero value otherwise. +func (o *VrfIpReservation) GetManagement() bool { + if o == nil || IsNil(o.Management) { + var ret bool + return ret + } + return *o.Management +} + +// GetManagementOk returns a tuple with the Management field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetManagementOk() (*bool, bool) { + if o == nil || IsNil(o.Management) { + return nil, false + } + return o.Management, true +} + +// HasManagement returns a boolean if a field has been set. +func (o *VrfIpReservation) HasManagement() bool { + if o != nil && !IsNil(o.Management) { + return true + } + + return false +} + +// SetManagement gets a reference to the given bool and assigns it to the Management field. +func (o *VrfIpReservation) SetManagement(v bool) { + o.Management = &v +} + +// GetManageable returns the Manageable field value if set, zero value otherwise. +func (o *VrfIpReservation) GetManageable() bool { + if o == nil || IsNil(o.Manageable) { + var ret bool + return ret + } + return *o.Manageable +} + +// GetManageableOk returns a tuple with the Manageable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetManageableOk() (*bool, bool) { + if o == nil || IsNil(o.Manageable) { + return nil, false + } + return o.Manageable, true +} + +// HasManageable returns a boolean if a field has been set. +func (o *VrfIpReservation) HasManageable() bool { + if o != nil && !IsNil(o.Manageable) { + return true + } + + return false +} + +// SetManageable gets a reference to the given bool and assigns it to the Manageable field. +func (o *VrfIpReservation) SetManageable(v bool) { + o.Manageable = &v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *VrfIpReservation) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *VrfIpReservation) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *VrfIpReservation) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetBill returns the Bill field value if set, zero value otherwise. +func (o *VrfIpReservation) GetBill() bool { + if o == nil || IsNil(o.Bill) { + var ret bool + return ret + } + return *o.Bill +} + +// GetBillOk returns a tuple with the Bill field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetBillOk() (*bool, bool) { + if o == nil || IsNil(o.Bill) { + return nil, false + } + return o.Bill, true +} + +// HasBill returns a boolean if a field has been set. +func (o *VrfIpReservation) HasBill() bool { + if o != nil && !IsNil(o.Bill) { + return true + } + + return false +} + +// SetBill gets a reference to the given bool and assigns it to the Bill field. +func (o *VrfIpReservation) SetBill(v bool) { + o.Bill = &v +} + +// GetProjectLite returns the ProjectLite field value if set, zero value otherwise. +func (o *VrfIpReservation) GetProjectLite() Project { + if o == nil || IsNil(o.ProjectLite) { + var ret Project + return ret + } + return *o.ProjectLite +} + +// GetProjectLiteOk returns a tuple with the ProjectLite field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetProjectLiteOk() (*Project, bool) { + if o == nil || IsNil(o.ProjectLite) { + return nil, false + } + return o.ProjectLite, true +} + +// HasProjectLite returns a boolean if a field has been set. +func (o *VrfIpReservation) HasProjectLite() bool { + if o != nil && !IsNil(o.ProjectLite) { + return true + } + + return false +} + +// SetProjectLite gets a reference to the given Project and assigns it to the ProjectLite field. +func (o *VrfIpReservation) SetProjectLite(v Project) { + o.ProjectLite = &v +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *VrfIpReservation) GetAddress() string { + if o == nil || IsNil(o.Address) { + var ret string + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetAddressOk() (*string, bool) { + if o == nil || IsNil(o.Address) { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *VrfIpReservation) HasAddress() bool { + if o != nil && !IsNil(o.Address) { + return true + } + + return false +} + +// SetAddress gets a reference to the given string and assigns it to the Address field. +func (o *VrfIpReservation) SetAddress(v string) { + o.Address = &v +} + +// GetGateway returns the Gateway field value if set, zero value otherwise. +func (o *VrfIpReservation) GetGateway() string { + if o == nil || IsNil(o.Gateway) { + var ret string + return ret + } + return *o.Gateway +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetGatewayOk() (*string, bool) { + if o == nil || IsNil(o.Gateway) { + return nil, false + } + return o.Gateway, true +} + +// HasGateway returns a boolean if a field has been set. +func (o *VrfIpReservation) HasGateway() bool { + if o != nil && !IsNil(o.Gateway) { + return true + } + + return false +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *VrfIpReservation) SetGateway(v string) { + o.Gateway = &v +} + +// GetMetro returns the Metro field value if set, zero value otherwise. +func (o *VrfIpReservation) GetMetro() Metro { + if o == nil || IsNil(o.Metro) { + var ret Metro + return ret + } + return *o.Metro +} + +// GetMetroOk returns a tuple with the Metro field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservation) GetMetroOk() (*Metro, bool) { + if o == nil || IsNil(o.Metro) { + return nil, false + } + return o.Metro, true +} + +// HasMetro returns a boolean if a field has been set. +func (o *VrfIpReservation) HasMetro() bool { + if o != nil && !IsNil(o.Metro) { + return true + } + + return false +} + +// SetMetro gets a reference to the given Metro and assigns it to the Metro field. +func (o *VrfIpReservation) SetMetro(v Metro) { + o.Metro = &v +} + +func (o VrfIpReservation) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfIpReservation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AddressFamily) { + toSerialize["address_family"] = o.AddressFamily + } + if !IsNil(o.Cidr) { + toSerialize["cidr"] = o.Cidr + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.CreatedBy) { + toSerialize["created_by"] = o.CreatedBy + } + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.MetalGateway) { + toSerialize["metal_gateway"] = o.MetalGateway + } + if !IsNil(o.Netmask) { + toSerialize["netmask"] = o.Netmask + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + toSerialize["type"] = o.Type + toSerialize["vrf"] = o.Vrf + if !IsNil(o.Public) { + toSerialize["public"] = o.Public + } + if !IsNil(o.Management) { + toSerialize["management"] = o.Management + } + if !IsNil(o.Manageable) { + toSerialize["manageable"] = o.Manageable + } + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Bill) { + toSerialize["bill"] = o.Bill + } + if !IsNil(o.ProjectLite) { + toSerialize["project_lite"] = o.ProjectLite + } + if !IsNil(o.Address) { + toSerialize["address"] = o.Address + } + if !IsNil(o.Gateway) { + toSerialize["gateway"] = o.Gateway + } + if !IsNil(o.Metro) { + toSerialize["metro"] = o.Metro + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfIpReservation) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "type", + "vrf", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVrfIpReservation := _VrfIpReservation{} + + err = json.Unmarshal(data, &varVrfIpReservation) + + if err != nil { + return err + } + + *o = VrfIpReservation(varVrfIpReservation) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address_family") + delete(additionalProperties, "cidr") + delete(additionalProperties, "created_at") + delete(additionalProperties, "created_by") + delete(additionalProperties, "details") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "metal_gateway") + delete(additionalProperties, "netmask") + delete(additionalProperties, "network") + delete(additionalProperties, "project") + delete(additionalProperties, "state") + delete(additionalProperties, "tags") + delete(additionalProperties, "type") + delete(additionalProperties, "vrf") + delete(additionalProperties, "public") + delete(additionalProperties, "management") + delete(additionalProperties, "manageable") + delete(additionalProperties, "customdata") + delete(additionalProperties, "bill") + delete(additionalProperties, "project_lite") + delete(additionalProperties, "address") + delete(additionalProperties, "gateway") + delete(additionalProperties, "metro") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfIpReservation struct { + value *VrfIpReservation + isSet bool +} + +func (v NullableVrfIpReservation) Get() *VrfIpReservation { + return v.value +} + +func (v *NullableVrfIpReservation) Set(val *VrfIpReservation) { + v.value = val + v.isSet = true +} + +func (v NullableVrfIpReservation) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfIpReservation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfIpReservation(val *VrfIpReservation) *NullableVrfIpReservation { + return &NullableVrfIpReservation{value: val, isSet: true} +} + +func (v NullableVrfIpReservation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfIpReservation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_create_input.go new file mode 100644 index 00000000..a16cad7a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_create_input.go @@ -0,0 +1,369 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the VrfIpReservationCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfIpReservationCreateInput{} + +// VrfIpReservationCreateInput struct for VrfIpReservationCreateInput +type VrfIpReservationCreateInput struct { + // The size of the VRF IP Reservation's subnet + Cidr int32 `json:"cidr"` + Customdata map[string]interface{} `json:"customdata,omitempty"` + Details *string `json:"details,omitempty"` + // The starting address for this VRF IP Reservation's subnet + Network string `json:"network"` + Tags []string `json:"tags,omitempty"` + // Must be set to 'vrf' + Type string `json:"type"` + // The ID of the VRF in which this VRF IP Reservation is created. The VRF must have an existing IP Range that contains the requested subnet. This field may be aliased as just 'vrf'. + VrfId string `json:"vrf_id"` + AdditionalProperties map[string]interface{} +} + +type _VrfIpReservationCreateInput VrfIpReservationCreateInput + +// NewVrfIpReservationCreateInput instantiates a new VrfIpReservationCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfIpReservationCreateInput(cidr int32, network string, type_ string, vrfId string) *VrfIpReservationCreateInput { + this := VrfIpReservationCreateInput{} + this.Cidr = cidr + this.Network = network + this.Type = type_ + this.VrfId = vrfId + return &this +} + +// NewVrfIpReservationCreateInputWithDefaults instantiates a new VrfIpReservationCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfIpReservationCreateInputWithDefaults() *VrfIpReservationCreateInput { + this := VrfIpReservationCreateInput{} + return &this +} + +// GetCidr returns the Cidr field value +func (o *VrfIpReservationCreateInput) GetCidr() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Cidr +} + +// GetCidrOk returns a tuple with the Cidr field value +// and a boolean to check if the value has been set. +func (o *VrfIpReservationCreateInput) GetCidrOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Cidr, true +} + +// SetCidr sets field value +func (o *VrfIpReservationCreateInput) SetCidr(v int32) { + o.Cidr = v +} + +// GetCustomdata returns the Customdata field value if set, zero value otherwise. +func (o *VrfIpReservationCreateInput) GetCustomdata() map[string]interface{} { + if o == nil || IsNil(o.Customdata) { + var ret map[string]interface{} + return ret + } + return o.Customdata +} + +// GetCustomdataOk returns a tuple with the Customdata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservationCreateInput) GetCustomdataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Customdata) { + return map[string]interface{}{}, false + } + return o.Customdata, true +} + +// HasCustomdata returns a boolean if a field has been set. +func (o *VrfIpReservationCreateInput) HasCustomdata() bool { + if o != nil && !IsNil(o.Customdata) { + return true + } + + return false +} + +// SetCustomdata gets a reference to the given map[string]interface{} and assigns it to the Customdata field. +func (o *VrfIpReservationCreateInput) SetCustomdata(v map[string]interface{}) { + o.Customdata = v +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *VrfIpReservationCreateInput) GetDetails() string { + if o == nil || IsNil(o.Details) { + var ret string + return ret + } + return *o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservationCreateInput) GetDetailsOk() (*string, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *VrfIpReservationCreateInput) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *VrfIpReservationCreateInput) SetDetails(v string) { + o.Details = &v +} + +// GetNetwork returns the Network field value +func (o *VrfIpReservationCreateInput) GetNetwork() string { + if o == nil { + var ret string + return ret + } + + return o.Network +} + +// GetNetworkOk returns a tuple with the Network field value +// and a boolean to check if the value has been set. +func (o *VrfIpReservationCreateInput) GetNetworkOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Network, true +} + +// SetNetwork sets field value +func (o *VrfIpReservationCreateInput) SetNetwork(v string) { + o.Network = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VrfIpReservationCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservationCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VrfIpReservationCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VrfIpReservationCreateInput) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value +func (o *VrfIpReservationCreateInput) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *VrfIpReservationCreateInput) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *VrfIpReservationCreateInput) SetType(v string) { + o.Type = v +} + +// GetVrfId returns the VrfId field value +func (o *VrfIpReservationCreateInput) GetVrfId() string { + if o == nil { + var ret string + return ret + } + + return o.VrfId +} + +// GetVrfIdOk returns a tuple with the VrfId field value +// and a boolean to check if the value has been set. +func (o *VrfIpReservationCreateInput) GetVrfIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.VrfId, true +} + +// SetVrfId sets field value +func (o *VrfIpReservationCreateInput) SetVrfId(v string) { + o.VrfId = v +} + +func (o VrfIpReservationCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfIpReservationCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cidr"] = o.Cidr + if !IsNil(o.Customdata) { + toSerialize["customdata"] = o.Customdata + } + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + toSerialize["network"] = o.Network + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + toSerialize["type"] = o.Type + toSerialize["vrf_id"] = o.VrfId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfIpReservationCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "cidr", + "network", + "type", + "vrf_id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVrfIpReservationCreateInput := _VrfIpReservationCreateInput{} + + err = json.Unmarshal(data, &varVrfIpReservationCreateInput) + + if err != nil { + return err + } + + *o = VrfIpReservationCreateInput(varVrfIpReservationCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cidr") + delete(additionalProperties, "customdata") + delete(additionalProperties, "details") + delete(additionalProperties, "network") + delete(additionalProperties, "tags") + delete(additionalProperties, "type") + delete(additionalProperties, "vrf_id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfIpReservationCreateInput struct { + value *VrfIpReservationCreateInput + isSet bool +} + +func (v NullableVrfIpReservationCreateInput) Get() *VrfIpReservationCreateInput { + return v.value +} + +func (v *NullableVrfIpReservationCreateInput) Set(val *VrfIpReservationCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVrfIpReservationCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfIpReservationCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfIpReservationCreateInput(val *VrfIpReservationCreateInput) *NullableVrfIpReservationCreateInput { + return &NullableVrfIpReservationCreateInput{value: val, isSet: true} +} + +func (v NullableVrfIpReservationCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfIpReservationCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_list.go new file mode 100644 index 00000000..0ddf37b6 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the VrfIpReservationList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfIpReservationList{} + +// VrfIpReservationList struct for VrfIpReservationList +type VrfIpReservationList struct { + IpAddresses []VrfIpReservation `json:"ip_addresses,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfIpReservationList VrfIpReservationList + +// NewVrfIpReservationList instantiates a new VrfIpReservationList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfIpReservationList() *VrfIpReservationList { + this := VrfIpReservationList{} + return &this +} + +// NewVrfIpReservationListWithDefaults instantiates a new VrfIpReservationList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfIpReservationListWithDefaults() *VrfIpReservationList { + this := VrfIpReservationList{} + return &this +} + +// GetIpAddresses returns the IpAddresses field value if set, zero value otherwise. +func (o *VrfIpReservationList) GetIpAddresses() []VrfIpReservation { + if o == nil || IsNil(o.IpAddresses) { + var ret []VrfIpReservation + return ret + } + return o.IpAddresses +} + +// GetIpAddressesOk returns a tuple with the IpAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfIpReservationList) GetIpAddressesOk() ([]VrfIpReservation, bool) { + if o == nil || IsNil(o.IpAddresses) { + return nil, false + } + return o.IpAddresses, true +} + +// HasIpAddresses returns a boolean if a field has been set. +func (o *VrfIpReservationList) HasIpAddresses() bool { + if o != nil && !IsNil(o.IpAddresses) { + return true + } + + return false +} + +// SetIpAddresses gets a reference to the given []VrfIpReservation and assigns it to the IpAddresses field. +func (o *VrfIpReservationList) SetIpAddresses(v []VrfIpReservation) { + o.IpAddresses = v +} + +func (o VrfIpReservationList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfIpReservationList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.IpAddresses) { + toSerialize["ip_addresses"] = o.IpAddresses + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfIpReservationList) UnmarshalJSON(data []byte) (err error) { + varVrfIpReservationList := _VrfIpReservationList{} + + err = json.Unmarshal(data, &varVrfIpReservationList) + + if err != nil { + return err + } + + *o = VrfIpReservationList(varVrfIpReservationList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ip_addresses") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfIpReservationList struct { + value *VrfIpReservationList + isSet bool +} + +func (v NullableVrfIpReservationList) Get() *VrfIpReservationList { + return v.value +} + +func (v *NullableVrfIpReservationList) Set(val *VrfIpReservationList) { + v.value = val + v.isSet = true +} + +func (v NullableVrfIpReservationList) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfIpReservationList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfIpReservationList(val *VrfIpReservationList) *NullableVrfIpReservationList { + return &NullableVrfIpReservationList{value: val, isSet: true} +} + +func (v NullableVrfIpReservationList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfIpReservationList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_type.go new file mode 100644 index 00000000..cedf4914 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_ip_reservation_type.go @@ -0,0 +1,109 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VrfIpReservationType the model 'VrfIpReservationType' +type VrfIpReservationType string + +// List of VrfIpReservation_type +const ( + VRFIPRESERVATIONTYPE_VRF VrfIpReservationType = "vrf" +) + +// All allowed values of VrfIpReservationType enum +var AllowedVrfIpReservationTypeEnumValues = []VrfIpReservationType{ + "vrf", +} + +func (v *VrfIpReservationType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VrfIpReservationType(value) + for _, existing := range AllowedVrfIpReservationTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid VrfIpReservationType", value) +} + +// NewVrfIpReservationTypeFromValue returns a pointer to a valid VrfIpReservationType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVrfIpReservationTypeFromValue(v string) (*VrfIpReservationType, error) { + ev := VrfIpReservationType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VrfIpReservationType: valid values are %v", v, AllowedVrfIpReservationTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VrfIpReservationType) IsValid() bool { + for _, existing := range AllowedVrfIpReservationTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VrfIpReservation_type value +func (v VrfIpReservationType) Ptr() *VrfIpReservationType { + return &v +} + +type NullableVrfIpReservationType struct { + value *VrfIpReservationType + isSet bool +} + +func (v NullableVrfIpReservationType) Get() *VrfIpReservationType { + return v.value +} + +func (v *NullableVrfIpReservationType) Set(val *VrfIpReservationType) { + v.value = val + v.isSet = true +} + +func (v NullableVrfIpReservationType) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfIpReservationType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfIpReservationType(val *VrfIpReservationType) *NullableVrfIpReservationType { + return &NullableVrfIpReservationType{value: val, isSet: true} +} + +func (v NullableVrfIpReservationType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfIpReservationType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_list.go new file mode 100644 index 00000000..857814aa --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_list.go @@ -0,0 +1,154 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the VrfList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfList{} + +// VrfList struct for VrfList +type VrfList struct { + Vrfs []Vrf `json:"vrfs,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfList VrfList + +// NewVrfList instantiates a new VrfList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfList() *VrfList { + this := VrfList{} + return &this +} + +// NewVrfListWithDefaults instantiates a new VrfList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfListWithDefaults() *VrfList { + this := VrfList{} + return &this +} + +// GetVrfs returns the Vrfs field value if set, zero value otherwise. +func (o *VrfList) GetVrfs() []Vrf { + if o == nil || IsNil(o.Vrfs) { + var ret []Vrf + return ret + } + return o.Vrfs +} + +// GetVrfsOk returns a tuple with the Vrfs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfList) GetVrfsOk() ([]Vrf, bool) { + if o == nil || IsNil(o.Vrfs) { + return nil, false + } + return o.Vrfs, true +} + +// HasVrfs returns a boolean if a field has been set. +func (o *VrfList) HasVrfs() bool { + if o != nil && !IsNil(o.Vrfs) { + return true + } + + return false +} + +// SetVrfs gets a reference to the given []Vrf and assigns it to the Vrfs field. +func (o *VrfList) SetVrfs(v []Vrf) { + o.Vrfs = v +} + +func (o VrfList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Vrfs) { + toSerialize["vrfs"] = o.Vrfs + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfList) UnmarshalJSON(data []byte) (err error) { + varVrfList := _VrfList{} + + err = json.Unmarshal(data, &varVrfList) + + if err != nil { + return err + } + + *o = VrfList(varVrfList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "vrfs") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfList struct { + value *VrfList + isSet bool +} + +func (v NullableVrfList) Get() *VrfList { + return v.value +} + +func (v *NullableVrfList) Set(val *VrfList) { + v.value = val + v.isSet = true +} + +func (v NullableVrfList) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfList(val *VrfList) *NullableVrfList { + return &NullableVrfList{value: val, isSet: true} +} + +func (v NullableVrfList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_metal_gateway.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_metal_gateway.go new file mode 100644 index 00000000..c2de880b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_metal_gateway.go @@ -0,0 +1,488 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the VrfMetalGateway type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfMetalGateway{} + +// VrfMetalGateway struct for VrfMetalGateway +type VrfMetalGateway struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + CreatedBy *Href `json:"created_by,omitempty"` + Href *string `json:"href,omitempty"` + Id *string `json:"id,omitempty"` + IpReservation *VrfIpReservation `json:"ip_reservation,omitempty"` + Project *Project `json:"project,omitempty"` + State *MetalGatewayState `json:"state,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + VirtualNetwork *VirtualNetwork `json:"virtual_network,omitempty"` + Vrf *Vrf `json:"vrf,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfMetalGateway VrfMetalGateway + +// NewVrfMetalGateway instantiates a new VrfMetalGateway object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfMetalGateway() *VrfMetalGateway { + this := VrfMetalGateway{} + return &this +} + +// NewVrfMetalGatewayWithDefaults instantiates a new VrfMetalGateway object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfMetalGatewayWithDefaults() *VrfMetalGateway { + this := VrfMetalGateway{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *VrfMetalGateway) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfMetalGateway) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *VrfMetalGateway) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *VrfMetalGateway) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *VrfMetalGateway) GetCreatedBy() Href { + if o == nil || IsNil(o.CreatedBy) { + var ret Href + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfMetalGateway) GetCreatedByOk() (*Href, bool) { + if o == nil || IsNil(o.CreatedBy) { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *VrfMetalGateway) HasCreatedBy() bool { + if o != nil && !IsNil(o.CreatedBy) { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given Href and assigns it to the CreatedBy field. +func (o *VrfMetalGateway) SetCreatedBy(v Href) { + o.CreatedBy = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *VrfMetalGateway) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfMetalGateway) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *VrfMetalGateway) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *VrfMetalGateway) SetHref(v string) { + o.Href = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *VrfMetalGateway) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfMetalGateway) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *VrfMetalGateway) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *VrfMetalGateway) SetId(v string) { + o.Id = &v +} + +// GetIpReservation returns the IpReservation field value if set, zero value otherwise. +func (o *VrfMetalGateway) GetIpReservation() VrfIpReservation { + if o == nil || IsNil(o.IpReservation) { + var ret VrfIpReservation + return ret + } + return *o.IpReservation +} + +// GetIpReservationOk returns a tuple with the IpReservation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfMetalGateway) GetIpReservationOk() (*VrfIpReservation, bool) { + if o == nil || IsNil(o.IpReservation) { + return nil, false + } + return o.IpReservation, true +} + +// HasIpReservation returns a boolean if a field has been set. +func (o *VrfMetalGateway) HasIpReservation() bool { + if o != nil && !IsNil(o.IpReservation) { + return true + } + + return false +} + +// SetIpReservation gets a reference to the given VrfIpReservation and assigns it to the IpReservation field. +func (o *VrfMetalGateway) SetIpReservation(v VrfIpReservation) { + o.IpReservation = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *VrfMetalGateway) GetProject() Project { + if o == nil || IsNil(o.Project) { + var ret Project + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfMetalGateway) GetProjectOk() (*Project, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *VrfMetalGateway) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Project and assigns it to the Project field. +func (o *VrfMetalGateway) SetProject(v Project) { + o.Project = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *VrfMetalGateway) GetState() MetalGatewayState { + if o == nil || IsNil(o.State) { + var ret MetalGatewayState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfMetalGateway) GetStateOk() (*MetalGatewayState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *VrfMetalGateway) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given MetalGatewayState and assigns it to the State field. +func (o *VrfMetalGateway) SetState(v MetalGatewayState) { + o.State = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *VrfMetalGateway) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfMetalGateway) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *VrfMetalGateway) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *VrfMetalGateway) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetVirtualNetwork returns the VirtualNetwork field value if set, zero value otherwise. +func (o *VrfMetalGateway) GetVirtualNetwork() VirtualNetwork { + if o == nil || IsNil(o.VirtualNetwork) { + var ret VirtualNetwork + return ret + } + return *o.VirtualNetwork +} + +// GetVirtualNetworkOk returns a tuple with the VirtualNetwork field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfMetalGateway) GetVirtualNetworkOk() (*VirtualNetwork, bool) { + if o == nil || IsNil(o.VirtualNetwork) { + return nil, false + } + return o.VirtualNetwork, true +} + +// HasVirtualNetwork returns a boolean if a field has been set. +func (o *VrfMetalGateway) HasVirtualNetwork() bool { + if o != nil && !IsNil(o.VirtualNetwork) { + return true + } + + return false +} + +// SetVirtualNetwork gets a reference to the given VirtualNetwork and assigns it to the VirtualNetwork field. +func (o *VrfMetalGateway) SetVirtualNetwork(v VirtualNetwork) { + o.VirtualNetwork = &v +} + +// GetVrf returns the Vrf field value if set, zero value otherwise. +func (o *VrfMetalGateway) GetVrf() Vrf { + if o == nil || IsNil(o.Vrf) { + var ret Vrf + return ret + } + return *o.Vrf +} + +// GetVrfOk returns a tuple with the Vrf field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfMetalGateway) GetVrfOk() (*Vrf, bool) { + if o == nil || IsNil(o.Vrf) { + return nil, false + } + return o.Vrf, true +} + +// HasVrf returns a boolean if a field has been set. +func (o *VrfMetalGateway) HasVrf() bool { + if o != nil && !IsNil(o.Vrf) { + return true + } + + return false +} + +// SetVrf gets a reference to the given Vrf and assigns it to the Vrf field. +func (o *VrfMetalGateway) SetVrf(v Vrf) { + o.Vrf = &v +} + +func (o VrfMetalGateway) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfMetalGateway) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.CreatedBy) { + toSerialize["created_by"] = o.CreatedBy + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.IpReservation) { + toSerialize["ip_reservation"] = o.IpReservation + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.VirtualNetwork) { + toSerialize["virtual_network"] = o.VirtualNetwork + } + if !IsNil(o.Vrf) { + toSerialize["vrf"] = o.Vrf + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfMetalGateway) UnmarshalJSON(data []byte) (err error) { + varVrfMetalGateway := _VrfMetalGateway{} + + err = json.Unmarshal(data, &varVrfMetalGateway) + + if err != nil { + return err + } + + *o = VrfMetalGateway(varVrfMetalGateway) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "created_by") + delete(additionalProperties, "href") + delete(additionalProperties, "id") + delete(additionalProperties, "ip_reservation") + delete(additionalProperties, "project") + delete(additionalProperties, "state") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "virtual_network") + delete(additionalProperties, "vrf") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfMetalGateway struct { + value *VrfMetalGateway + isSet bool +} + +func (v NullableVrfMetalGateway) Get() *VrfMetalGateway { + return v.value +} + +func (v *NullableVrfMetalGateway) Set(val *VrfMetalGateway) { + v.value = val + v.isSet = true +} + +func (v NullableVrfMetalGateway) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfMetalGateway) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfMetalGateway(val *VrfMetalGateway) *NullableVrfMetalGateway { + return &NullableVrfMetalGateway{value: val, isSet: true} +} + +func (v NullableVrfMetalGateway) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfMetalGateway) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_metal_gateway_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_metal_gateway_create_input.go new file mode 100644 index 00000000..8d8fdbb1 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_metal_gateway_create_input.go @@ -0,0 +1,198 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the VrfMetalGatewayCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfMetalGatewayCreateInput{} + +// VrfMetalGatewayCreateInput struct for VrfMetalGatewayCreateInput +type VrfMetalGatewayCreateInput struct { + // The UUID an a VRF IP Reservation that belongs to the same project as the one in which the Metal Gateway is to be created. Additionally, the VRF IP Reservation and the Virtual Network must reside in the same Metro. + IpReservationId string `json:"ip_reservation_id"` + // THe UUID of a Metro Virtual Network that belongs to the same project as the one in which the Metal Gateway is to be created. Additionally, the Virtual Network and the VRF IP Reservation must reside in the same metro. + VirtualNetworkId string `json:"virtual_network_id"` + AdditionalProperties map[string]interface{} +} + +type _VrfMetalGatewayCreateInput VrfMetalGatewayCreateInput + +// NewVrfMetalGatewayCreateInput instantiates a new VrfMetalGatewayCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfMetalGatewayCreateInput(ipReservationId string, virtualNetworkId string) *VrfMetalGatewayCreateInput { + this := VrfMetalGatewayCreateInput{} + this.IpReservationId = ipReservationId + this.VirtualNetworkId = virtualNetworkId + return &this +} + +// NewVrfMetalGatewayCreateInputWithDefaults instantiates a new VrfMetalGatewayCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfMetalGatewayCreateInputWithDefaults() *VrfMetalGatewayCreateInput { + this := VrfMetalGatewayCreateInput{} + return &this +} + +// GetIpReservationId returns the IpReservationId field value +func (o *VrfMetalGatewayCreateInput) GetIpReservationId() string { + if o == nil { + var ret string + return ret + } + + return o.IpReservationId +} + +// GetIpReservationIdOk returns a tuple with the IpReservationId field value +// and a boolean to check if the value has been set. +func (o *VrfMetalGatewayCreateInput) GetIpReservationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.IpReservationId, true +} + +// SetIpReservationId sets field value +func (o *VrfMetalGatewayCreateInput) SetIpReservationId(v string) { + o.IpReservationId = v +} + +// GetVirtualNetworkId returns the VirtualNetworkId field value +func (o *VrfMetalGatewayCreateInput) GetVirtualNetworkId() string { + if o == nil { + var ret string + return ret + } + + return o.VirtualNetworkId +} + +// GetVirtualNetworkIdOk returns a tuple with the VirtualNetworkId field value +// and a boolean to check if the value has been set. +func (o *VrfMetalGatewayCreateInput) GetVirtualNetworkIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.VirtualNetworkId, true +} + +// SetVirtualNetworkId sets field value +func (o *VrfMetalGatewayCreateInput) SetVirtualNetworkId(v string) { + o.VirtualNetworkId = v +} + +func (o VrfMetalGatewayCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfMetalGatewayCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["ip_reservation_id"] = o.IpReservationId + toSerialize["virtual_network_id"] = o.VirtualNetworkId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfMetalGatewayCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "ip_reservation_id", + "virtual_network_id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVrfMetalGatewayCreateInput := _VrfMetalGatewayCreateInput{} + + err = json.Unmarshal(data, &varVrfMetalGatewayCreateInput) + + if err != nil { + return err + } + + *o = VrfMetalGatewayCreateInput(varVrfMetalGatewayCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ip_reservation_id") + delete(additionalProperties, "virtual_network_id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfMetalGatewayCreateInput struct { + value *VrfMetalGatewayCreateInput + isSet bool +} + +func (v NullableVrfMetalGatewayCreateInput) Get() *VrfMetalGatewayCreateInput { + return v.value +} + +func (v *NullableVrfMetalGatewayCreateInput) Set(val *VrfMetalGatewayCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVrfMetalGatewayCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfMetalGatewayCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfMetalGatewayCreateInput(val *VrfMetalGatewayCreateInput) *NullableVrfMetalGatewayCreateInput { + return &NullableVrfMetalGatewayCreateInput{value: val, isSet: true} +} + +func (v NullableVrfMetalGatewayCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfMetalGatewayCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route.go new file mode 100644 index 00000000..fd809b21 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route.go @@ -0,0 +1,565 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "time" +) + +// checks if the VrfRoute type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfRoute{} + +// VrfRoute struct for VrfRoute +type VrfRoute struct { + // The unique identifier for the newly-created resource + Id *string `json:"id,omitempty"` + Status *VrfRouteStatus `json:"status,omitempty"` + // The IPv4 prefix for the route, in CIDR-style notation + Prefix *string `json:"prefix,omitempty"` + // The next-hop IPv4 address for the route + NextHop *string `json:"next_hop,omitempty"` + Type *VrfRouteType `json:"type,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + MetalGateway *VrfMetalGateway `json:"metal_gateway,omitempty"` + VirtualNetwork *VirtualNetwork `json:"virtual_network,omitempty"` + Vrf *Vrf `json:"vrf,omitempty"` + Href *string `json:"href,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfRoute VrfRoute + +// NewVrfRoute instantiates a new VrfRoute object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfRoute() *VrfRoute { + this := VrfRoute{} + return &this +} + +// NewVrfRouteWithDefaults instantiates a new VrfRoute object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfRouteWithDefaults() *VrfRoute { + this := VrfRoute{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *VrfRoute) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *VrfRoute) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *VrfRoute) SetId(v string) { + o.Id = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *VrfRoute) GetStatus() VrfRouteStatus { + if o == nil || IsNil(o.Status) { + var ret VrfRouteStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetStatusOk() (*VrfRouteStatus, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *VrfRoute) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given VrfRouteStatus and assigns it to the Status field. +func (o *VrfRoute) SetStatus(v VrfRouteStatus) { + o.Status = &v +} + +// GetPrefix returns the Prefix field value if set, zero value otherwise. +func (o *VrfRoute) GetPrefix() string { + if o == nil || IsNil(o.Prefix) { + var ret string + return ret + } + return *o.Prefix +} + +// GetPrefixOk returns a tuple with the Prefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetPrefixOk() (*string, bool) { + if o == nil || IsNil(o.Prefix) { + return nil, false + } + return o.Prefix, true +} + +// HasPrefix returns a boolean if a field has been set. +func (o *VrfRoute) HasPrefix() bool { + if o != nil && !IsNil(o.Prefix) { + return true + } + + return false +} + +// SetPrefix gets a reference to the given string and assigns it to the Prefix field. +func (o *VrfRoute) SetPrefix(v string) { + o.Prefix = &v +} + +// GetNextHop returns the NextHop field value if set, zero value otherwise. +func (o *VrfRoute) GetNextHop() string { + if o == nil || IsNil(o.NextHop) { + var ret string + return ret + } + return *o.NextHop +} + +// GetNextHopOk returns a tuple with the NextHop field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetNextHopOk() (*string, bool) { + if o == nil || IsNil(o.NextHop) { + return nil, false + } + return o.NextHop, true +} + +// HasNextHop returns a boolean if a field has been set. +func (o *VrfRoute) HasNextHop() bool { + if o != nil && !IsNil(o.NextHop) { + return true + } + + return false +} + +// SetNextHop gets a reference to the given string and assigns it to the NextHop field. +func (o *VrfRoute) SetNextHop(v string) { + o.NextHop = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *VrfRoute) GetType() VrfRouteType { + if o == nil || IsNil(o.Type) { + var ret VrfRouteType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetTypeOk() (*VrfRouteType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *VrfRoute) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given VrfRouteType and assigns it to the Type field. +func (o *VrfRoute) SetType(v VrfRouteType) { + o.Type = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *VrfRoute) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *VrfRoute) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *VrfRoute) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *VrfRoute) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *VrfRoute) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *VrfRoute) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetMetalGateway returns the MetalGateway field value if set, zero value otherwise. +func (o *VrfRoute) GetMetalGateway() VrfMetalGateway { + if o == nil || IsNil(o.MetalGateway) { + var ret VrfMetalGateway + return ret + } + return *o.MetalGateway +} + +// GetMetalGatewayOk returns a tuple with the MetalGateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetMetalGatewayOk() (*VrfMetalGateway, bool) { + if o == nil || IsNil(o.MetalGateway) { + return nil, false + } + return o.MetalGateway, true +} + +// HasMetalGateway returns a boolean if a field has been set. +func (o *VrfRoute) HasMetalGateway() bool { + if o != nil && !IsNil(o.MetalGateway) { + return true + } + + return false +} + +// SetMetalGateway gets a reference to the given VrfMetalGateway and assigns it to the MetalGateway field. +func (o *VrfRoute) SetMetalGateway(v VrfMetalGateway) { + o.MetalGateway = &v +} + +// GetVirtualNetwork returns the VirtualNetwork field value if set, zero value otherwise. +func (o *VrfRoute) GetVirtualNetwork() VirtualNetwork { + if o == nil || IsNil(o.VirtualNetwork) { + var ret VirtualNetwork + return ret + } + return *o.VirtualNetwork +} + +// GetVirtualNetworkOk returns a tuple with the VirtualNetwork field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetVirtualNetworkOk() (*VirtualNetwork, bool) { + if o == nil || IsNil(o.VirtualNetwork) { + return nil, false + } + return o.VirtualNetwork, true +} + +// HasVirtualNetwork returns a boolean if a field has been set. +func (o *VrfRoute) HasVirtualNetwork() bool { + if o != nil && !IsNil(o.VirtualNetwork) { + return true + } + + return false +} + +// SetVirtualNetwork gets a reference to the given VirtualNetwork and assigns it to the VirtualNetwork field. +func (o *VrfRoute) SetVirtualNetwork(v VirtualNetwork) { + o.VirtualNetwork = &v +} + +// GetVrf returns the Vrf field value if set, zero value otherwise. +func (o *VrfRoute) GetVrf() Vrf { + if o == nil || IsNil(o.Vrf) { + var ret Vrf + return ret + } + return *o.Vrf +} + +// GetVrfOk returns a tuple with the Vrf field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetVrfOk() (*Vrf, bool) { + if o == nil || IsNil(o.Vrf) { + return nil, false + } + return o.Vrf, true +} + +// HasVrf returns a boolean if a field has been set. +func (o *VrfRoute) HasVrf() bool { + if o != nil && !IsNil(o.Vrf) { + return true + } + + return false +} + +// SetVrf gets a reference to the given Vrf and assigns it to the Vrf field. +func (o *VrfRoute) SetVrf(v Vrf) { + o.Vrf = &v +} + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *VrfRoute) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetHrefOk() (*string, bool) { + if o == nil || IsNil(o.Href) { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *VrfRoute) HasHref() bool { + if o != nil && !IsNil(o.Href) { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *VrfRoute) SetHref(v string) { + o.Href = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VrfRoute) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRoute) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VrfRoute) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VrfRoute) SetTags(v []string) { + o.Tags = v +} + +func (o VrfRoute) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfRoute) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.Prefix) { + toSerialize["prefix"] = o.Prefix + } + if !IsNil(o.NextHop) { + toSerialize["next_hop"] = o.NextHop + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.MetalGateway) { + toSerialize["metal_gateway"] = o.MetalGateway + } + if !IsNil(o.VirtualNetwork) { + toSerialize["virtual_network"] = o.VirtualNetwork + } + if !IsNil(o.Vrf) { + toSerialize["vrf"] = o.Vrf + } + if !IsNil(o.Href) { + toSerialize["href"] = o.Href + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfRoute) UnmarshalJSON(data []byte) (err error) { + varVrfRoute := _VrfRoute{} + + err = json.Unmarshal(data, &varVrfRoute) + + if err != nil { + return err + } + + *o = VrfRoute(varVrfRoute) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "status") + delete(additionalProperties, "prefix") + delete(additionalProperties, "next_hop") + delete(additionalProperties, "type") + delete(additionalProperties, "created_at") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "metal_gateway") + delete(additionalProperties, "virtual_network") + delete(additionalProperties, "vrf") + delete(additionalProperties, "href") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfRoute struct { + value *VrfRoute + isSet bool +} + +func (v NullableVrfRoute) Get() *VrfRoute { + return v.value +} + +func (v *NullableVrfRoute) Set(val *VrfRoute) { + v.value = val + v.isSet = true +} + +func (v NullableVrfRoute) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfRoute) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfRoute(val *VrfRoute) *NullableVrfRoute { + return &NullableVrfRoute{value: val, isSet: true} +} + +func (v NullableVrfRoute) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfRoute) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_create_input.go new file mode 100644 index 00000000..02053b15 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_create_input.go @@ -0,0 +1,235 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the VrfRouteCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfRouteCreateInput{} + +// VrfRouteCreateInput struct for VrfRouteCreateInput +type VrfRouteCreateInput struct { + // The IPv4 prefix for the route, in CIDR-style notation. For a static default route, this will always be \"0.0.0.0/0\" + Prefix string `json:"prefix"` + // The IPv4 address within the VRF of the host that will handle this route + NextHop string `json:"next_hop"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfRouteCreateInput VrfRouteCreateInput + +// NewVrfRouteCreateInput instantiates a new VrfRouteCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfRouteCreateInput(prefix string, nextHop string) *VrfRouteCreateInput { + this := VrfRouteCreateInput{} + this.Prefix = prefix + this.NextHop = nextHop + return &this +} + +// NewVrfRouteCreateInputWithDefaults instantiates a new VrfRouteCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfRouteCreateInputWithDefaults() *VrfRouteCreateInput { + this := VrfRouteCreateInput{} + return &this +} + +// GetPrefix returns the Prefix field value +func (o *VrfRouteCreateInput) GetPrefix() string { + if o == nil { + var ret string + return ret + } + + return o.Prefix +} + +// GetPrefixOk returns a tuple with the Prefix field value +// and a boolean to check if the value has been set. +func (o *VrfRouteCreateInput) GetPrefixOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Prefix, true +} + +// SetPrefix sets field value +func (o *VrfRouteCreateInput) SetPrefix(v string) { + o.Prefix = v +} + +// GetNextHop returns the NextHop field value +func (o *VrfRouteCreateInput) GetNextHop() string { + if o == nil { + var ret string + return ret + } + + return o.NextHop +} + +// GetNextHopOk returns a tuple with the NextHop field value +// and a boolean to check if the value has been set. +func (o *VrfRouteCreateInput) GetNextHopOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextHop, true +} + +// SetNextHop sets field value +func (o *VrfRouteCreateInput) SetNextHop(v string) { + o.NextHop = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VrfRouteCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRouteCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VrfRouteCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VrfRouteCreateInput) SetTags(v []string) { + o.Tags = v +} + +func (o VrfRouteCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfRouteCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["prefix"] = o.Prefix + toSerialize["next_hop"] = o.NextHop + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfRouteCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "prefix", + "next_hop", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVrfRouteCreateInput := _VrfRouteCreateInput{} + + err = json.Unmarshal(data, &varVrfRouteCreateInput) + + if err != nil { + return err + } + + *o = VrfRouteCreateInput(varVrfRouteCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "prefix") + delete(additionalProperties, "next_hop") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfRouteCreateInput struct { + value *VrfRouteCreateInput + isSet bool +} + +func (v NullableVrfRouteCreateInput) Get() *VrfRouteCreateInput { + return v.value +} + +func (v *NullableVrfRouteCreateInput) Set(val *VrfRouteCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVrfRouteCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfRouteCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfRouteCreateInput(val *VrfRouteCreateInput) *NullableVrfRouteCreateInput { + return &NullableVrfRouteCreateInput{value: val, isSet: true} +} + +func (v NullableVrfRouteCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfRouteCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_list.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_list.go new file mode 100644 index 00000000..3d956d74 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_list.go @@ -0,0 +1,191 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the VrfRouteList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfRouteList{} + +// VrfRouteList struct for VrfRouteList +type VrfRouteList struct { + Routes []VrfRoute `json:"routes,omitempty"` + Meta *Meta `json:"meta,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfRouteList VrfRouteList + +// NewVrfRouteList instantiates a new VrfRouteList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfRouteList() *VrfRouteList { + this := VrfRouteList{} + return &this +} + +// NewVrfRouteListWithDefaults instantiates a new VrfRouteList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfRouteListWithDefaults() *VrfRouteList { + this := VrfRouteList{} + return &this +} + +// GetRoutes returns the Routes field value if set, zero value otherwise. +func (o *VrfRouteList) GetRoutes() []VrfRoute { + if o == nil || IsNil(o.Routes) { + var ret []VrfRoute + return ret + } + return o.Routes +} + +// GetRoutesOk returns a tuple with the Routes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRouteList) GetRoutesOk() ([]VrfRoute, bool) { + if o == nil || IsNil(o.Routes) { + return nil, false + } + return o.Routes, true +} + +// HasRoutes returns a boolean if a field has been set. +func (o *VrfRouteList) HasRoutes() bool { + if o != nil && !IsNil(o.Routes) { + return true + } + + return false +} + +// SetRoutes gets a reference to the given []VrfRoute and assigns it to the Routes field. +func (o *VrfRouteList) SetRoutes(v []VrfRoute) { + o.Routes = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *VrfRouteList) GetMeta() Meta { + if o == nil || IsNil(o.Meta) { + var ret Meta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRouteList) GetMetaOk() (*Meta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *VrfRouteList) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given Meta and assigns it to the Meta field. +func (o *VrfRouteList) SetMeta(v Meta) { + o.Meta = &v +} + +func (o VrfRouteList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfRouteList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Routes) { + toSerialize["routes"] = o.Routes + } + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfRouteList) UnmarshalJSON(data []byte) (err error) { + varVrfRouteList := _VrfRouteList{} + + err = json.Unmarshal(data, &varVrfRouteList) + + if err != nil { + return err + } + + *o = VrfRouteList(varVrfRouteList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "routes") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfRouteList struct { + value *VrfRouteList + isSet bool +} + +func (v NullableVrfRouteList) Get() *VrfRouteList { + return v.value +} + +func (v *NullableVrfRouteList) Set(val *VrfRouteList) { + v.value = val + v.isSet = true +} + +func (v NullableVrfRouteList) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfRouteList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfRouteList(val *VrfRouteList) *NullableVrfRouteList { + return &NullableVrfRouteList{value: val, isSet: true} +} + +func (v NullableVrfRouteList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfRouteList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_status.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_status.go new file mode 100644 index 00000000..d900dd90 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_status.go @@ -0,0 +1,115 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VrfRouteStatus The status of the route. Potential values are \"pending\", \"active\", \"deleting\", and \"error\", representing various lifecycle states of the route and whether or not it has been successfully configured on the network +type VrfRouteStatus string + +// List of VrfRoute_status +const ( + VRFROUTESTATUS_PENDING VrfRouteStatus = "pending" + VRFROUTESTATUS_ACTIVE VrfRouteStatus = "active" + VRFROUTESTATUS_DELETING VrfRouteStatus = "deleting" + VRFROUTESTATUS_ERROR VrfRouteStatus = "error" +) + +// All allowed values of VrfRouteStatus enum +var AllowedVrfRouteStatusEnumValues = []VrfRouteStatus{ + "pending", + "active", + "deleting", + "error", +} + +func (v *VrfRouteStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VrfRouteStatus(value) + for _, existing := range AllowedVrfRouteStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid VrfRouteStatus", value) +} + +// NewVrfRouteStatusFromValue returns a pointer to a valid VrfRouteStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVrfRouteStatusFromValue(v string) (*VrfRouteStatus, error) { + ev := VrfRouteStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VrfRouteStatus: valid values are %v", v, AllowedVrfRouteStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VrfRouteStatus) IsValid() bool { + for _, existing := range AllowedVrfRouteStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VrfRoute_status value +func (v VrfRouteStatus) Ptr() *VrfRouteStatus { + return &v +} + +type NullableVrfRouteStatus struct { + value *VrfRouteStatus + isSet bool +} + +func (v NullableVrfRouteStatus) Get() *VrfRouteStatus { + return v.value +} + +func (v *NullableVrfRouteStatus) Set(val *VrfRouteStatus) { + v.value = val + v.isSet = true +} + +func (v NullableVrfRouteStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfRouteStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfRouteStatus(val *VrfRouteStatus) *NullableVrfRouteStatus { + return &NullableVrfRouteStatus{value: val, isSet: true} +} + +func (v NullableVrfRouteStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfRouteStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_type.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_type.go new file mode 100644 index 00000000..6d255826 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_type.go @@ -0,0 +1,109 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VrfRouteType VRF route type, like 'bgp', 'connected', and 'static'. Currently, only static routes are supported +type VrfRouteType string + +// List of VrfRoute_type +const ( + VRFROUTETYPE_STATIC VrfRouteType = "static" +) + +// All allowed values of VrfRouteType enum +var AllowedVrfRouteTypeEnumValues = []VrfRouteType{ + "static", +} + +func (v *VrfRouteType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VrfRouteType(value) + for _, existing := range AllowedVrfRouteTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid VrfRouteType", value) +} + +// NewVrfRouteTypeFromValue returns a pointer to a valid VrfRouteType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVrfRouteTypeFromValue(v string) (*VrfRouteType, error) { + ev := VrfRouteType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VrfRouteType: valid values are %v", v, AllowedVrfRouteTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VrfRouteType) IsValid() bool { + for _, existing := range AllowedVrfRouteTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VrfRoute_type value +func (v VrfRouteType) Ptr() *VrfRouteType { + return &v +} + +type NullableVrfRouteType struct { + value *VrfRouteType + isSet bool +} + +func (v NullableVrfRouteType) Get() *VrfRouteType { + return v.value +} + +func (v *NullableVrfRouteType) Set(val *VrfRouteType) { + v.value = val + v.isSet = true +} + +func (v NullableVrfRouteType) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfRouteType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfRouteType(val *VrfRouteType) *NullableVrfRouteType { + return &NullableVrfRouteType{value: val, isSet: true} +} + +func (v NullableVrfRouteType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfRouteType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_update_input.go new file mode 100644 index 00000000..01890355 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_route_update_input.go @@ -0,0 +1,230 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the VrfRouteUpdateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfRouteUpdateInput{} + +// VrfRouteUpdateInput struct for VrfRouteUpdateInput +type VrfRouteUpdateInput struct { + // The IPv4 prefix for the route, in CIDR-style notation. For a static default route, this will always be \"0.0.0.0/0\" + Prefix *string `json:"prefix,omitempty"` + // The IPv4 address within the VRF of the host that will handle this route + NextHop *string `json:"next_hop,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfRouteUpdateInput VrfRouteUpdateInput + +// NewVrfRouteUpdateInput instantiates a new VrfRouteUpdateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfRouteUpdateInput() *VrfRouteUpdateInput { + this := VrfRouteUpdateInput{} + return &this +} + +// NewVrfRouteUpdateInputWithDefaults instantiates a new VrfRouteUpdateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfRouteUpdateInputWithDefaults() *VrfRouteUpdateInput { + this := VrfRouteUpdateInput{} + return &this +} + +// GetPrefix returns the Prefix field value if set, zero value otherwise. +func (o *VrfRouteUpdateInput) GetPrefix() string { + if o == nil || IsNil(o.Prefix) { + var ret string + return ret + } + return *o.Prefix +} + +// GetPrefixOk returns a tuple with the Prefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRouteUpdateInput) GetPrefixOk() (*string, bool) { + if o == nil || IsNil(o.Prefix) { + return nil, false + } + return o.Prefix, true +} + +// HasPrefix returns a boolean if a field has been set. +func (o *VrfRouteUpdateInput) HasPrefix() bool { + if o != nil && !IsNil(o.Prefix) { + return true + } + + return false +} + +// SetPrefix gets a reference to the given string and assigns it to the Prefix field. +func (o *VrfRouteUpdateInput) SetPrefix(v string) { + o.Prefix = &v +} + +// GetNextHop returns the NextHop field value if set, zero value otherwise. +func (o *VrfRouteUpdateInput) GetNextHop() string { + if o == nil || IsNil(o.NextHop) { + var ret string + return ret + } + return *o.NextHop +} + +// GetNextHopOk returns a tuple with the NextHop field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRouteUpdateInput) GetNextHopOk() (*string, bool) { + if o == nil || IsNil(o.NextHop) { + return nil, false + } + return o.NextHop, true +} + +// HasNextHop returns a boolean if a field has been set. +func (o *VrfRouteUpdateInput) HasNextHop() bool { + if o != nil && !IsNil(o.NextHop) { + return true + } + + return false +} + +// SetNextHop gets a reference to the given string and assigns it to the NextHop field. +func (o *VrfRouteUpdateInput) SetNextHop(v string) { + o.NextHop = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VrfRouteUpdateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfRouteUpdateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VrfRouteUpdateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VrfRouteUpdateInput) SetTags(v []string) { + o.Tags = v +} + +func (o VrfRouteUpdateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfRouteUpdateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Prefix) { + toSerialize["prefix"] = o.Prefix + } + if !IsNil(o.NextHop) { + toSerialize["next_hop"] = o.NextHop + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfRouteUpdateInput) UnmarshalJSON(data []byte) (err error) { + varVrfRouteUpdateInput := _VrfRouteUpdateInput{} + + err = json.Unmarshal(data, &varVrfRouteUpdateInput) + + if err != nil { + return err + } + + *o = VrfRouteUpdateInput(varVrfRouteUpdateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "prefix") + delete(additionalProperties, "next_hop") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfRouteUpdateInput struct { + value *VrfRouteUpdateInput + isSet bool +} + +func (v NullableVrfRouteUpdateInput) Get() *VrfRouteUpdateInput { + return v.value +} + +func (v *NullableVrfRouteUpdateInput) Set(val *VrfRouteUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVrfRouteUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfRouteUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfRouteUpdateInput(val *VrfRouteUpdateInput) *NullableVrfRouteUpdateInput { + return &NullableVrfRouteUpdateInput{value: val, isSet: true} +} + +func (v NullableVrfRouteUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfRouteUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_update_input.go new file mode 100644 index 00000000..3bd59a8b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_update_input.go @@ -0,0 +1,418 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the VrfUpdateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfUpdateInput{} + +// VrfUpdateInput struct for VrfUpdateInput +type VrfUpdateInput struct { + // Toggle to enable the dynamic bgp neighbors feature on the VRF + BgpDynamicNeighborsEnabled *bool `json:"bgp_dynamic_neighbors_enabled,omitempty"` + // Toggle to export the VRF route-map to the dynamic bgp neighbors + BgpDynamicNeighborsExportRouteMap *bool `json:"bgp_dynamic_neighbors_export_route_map,omitempty"` + // Toggle BFD on dynamic bgp neighbors sessions + BgpDynamicNeighborsBfdEnabled *bool `json:"bgp_dynamic_neighbors_bfd_enabled,omitempty"` + Description *string `json:"description,omitempty"` + // A list of CIDR network addresses. Like [\"10.0.0.0/16\", \"2001:d78::/56\"]. IPv4 blocks must be between /8 and /29 in size. IPv6 blocks must be between /56 and /64. A VRF\\'s IP ranges must be defined in order to create VRF IP Reservations, which can then be used for Metal Gateways or Virtual Circuits. Adding a new CIDR address to the list will result in the creation of a new IP Range for this VRF. Removal of an existing CIDR address from the list will result in the deletion of an existing IP Range for this VRF. Deleting an IP Range will result in the deletion of any VRF IP Reservations contained within the IP Range, as well as the VRF IP Reservation\\'s associated Metal Gateways or Virtual Circuits. If you do not wish to add or remove IP Ranges, either include the full existing list of IP Ranges in the update request, or do not specify the `ip_ranges` field in the update request. Specifying a value of `[]` will remove all existing IP Ranges from the VRF. + IpRanges []string `json:"ip_ranges,omitempty"` + // The new `local_asn` value for the VRF. This field cannot be updated when there are active Interconnection Virtual Circuits associated to the VRF, or if any of the VLANs of the VRF's metal gateway has been assigned on an instance. + LocalAsn *int32 `json:"local_asn,omitempty"` + Name *string `json:"name,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfUpdateInput VrfUpdateInput + +// NewVrfUpdateInput instantiates a new VrfUpdateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfUpdateInput() *VrfUpdateInput { + this := VrfUpdateInput{} + return &this +} + +// NewVrfUpdateInputWithDefaults instantiates a new VrfUpdateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfUpdateInputWithDefaults() *VrfUpdateInput { + this := VrfUpdateInput{} + return &this +} + +// GetBgpDynamicNeighborsEnabled returns the BgpDynamicNeighborsEnabled field value if set, zero value otherwise. +func (o *VrfUpdateInput) GetBgpDynamicNeighborsEnabled() bool { + if o == nil || IsNil(o.BgpDynamicNeighborsEnabled) { + var ret bool + return ret + } + return *o.BgpDynamicNeighborsEnabled +} + +// GetBgpDynamicNeighborsEnabledOk returns a tuple with the BgpDynamicNeighborsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfUpdateInput) GetBgpDynamicNeighborsEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.BgpDynamicNeighborsEnabled) { + return nil, false + } + return o.BgpDynamicNeighborsEnabled, true +} + +// HasBgpDynamicNeighborsEnabled returns a boolean if a field has been set. +func (o *VrfUpdateInput) HasBgpDynamicNeighborsEnabled() bool { + if o != nil && !IsNil(o.BgpDynamicNeighborsEnabled) { + return true + } + + return false +} + +// SetBgpDynamicNeighborsEnabled gets a reference to the given bool and assigns it to the BgpDynamicNeighborsEnabled field. +func (o *VrfUpdateInput) SetBgpDynamicNeighborsEnabled(v bool) { + o.BgpDynamicNeighborsEnabled = &v +} + +// GetBgpDynamicNeighborsExportRouteMap returns the BgpDynamicNeighborsExportRouteMap field value if set, zero value otherwise. +func (o *VrfUpdateInput) GetBgpDynamicNeighborsExportRouteMap() bool { + if o == nil || IsNil(o.BgpDynamicNeighborsExportRouteMap) { + var ret bool + return ret + } + return *o.BgpDynamicNeighborsExportRouteMap +} + +// GetBgpDynamicNeighborsExportRouteMapOk returns a tuple with the BgpDynamicNeighborsExportRouteMap field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfUpdateInput) GetBgpDynamicNeighborsExportRouteMapOk() (*bool, bool) { + if o == nil || IsNil(o.BgpDynamicNeighborsExportRouteMap) { + return nil, false + } + return o.BgpDynamicNeighborsExportRouteMap, true +} + +// HasBgpDynamicNeighborsExportRouteMap returns a boolean if a field has been set. +func (o *VrfUpdateInput) HasBgpDynamicNeighborsExportRouteMap() bool { + if o != nil && !IsNil(o.BgpDynamicNeighborsExportRouteMap) { + return true + } + + return false +} + +// SetBgpDynamicNeighborsExportRouteMap gets a reference to the given bool and assigns it to the BgpDynamicNeighborsExportRouteMap field. +func (o *VrfUpdateInput) SetBgpDynamicNeighborsExportRouteMap(v bool) { + o.BgpDynamicNeighborsExportRouteMap = &v +} + +// GetBgpDynamicNeighborsBfdEnabled returns the BgpDynamicNeighborsBfdEnabled field value if set, zero value otherwise. +func (o *VrfUpdateInput) GetBgpDynamicNeighborsBfdEnabled() bool { + if o == nil || IsNil(o.BgpDynamicNeighborsBfdEnabled) { + var ret bool + return ret + } + return *o.BgpDynamicNeighborsBfdEnabled +} + +// GetBgpDynamicNeighborsBfdEnabledOk returns a tuple with the BgpDynamicNeighborsBfdEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfUpdateInput) GetBgpDynamicNeighborsBfdEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.BgpDynamicNeighborsBfdEnabled) { + return nil, false + } + return o.BgpDynamicNeighborsBfdEnabled, true +} + +// HasBgpDynamicNeighborsBfdEnabled returns a boolean if a field has been set. +func (o *VrfUpdateInput) HasBgpDynamicNeighborsBfdEnabled() bool { + if o != nil && !IsNil(o.BgpDynamicNeighborsBfdEnabled) { + return true + } + + return false +} + +// SetBgpDynamicNeighborsBfdEnabled gets a reference to the given bool and assigns it to the BgpDynamicNeighborsBfdEnabled field. +func (o *VrfUpdateInput) SetBgpDynamicNeighborsBfdEnabled(v bool) { + o.BgpDynamicNeighborsBfdEnabled = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VrfUpdateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfUpdateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VrfUpdateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VrfUpdateInput) SetDescription(v string) { + o.Description = &v +} + +// GetIpRanges returns the IpRanges field value if set, zero value otherwise. +func (o *VrfUpdateInput) GetIpRanges() []string { + if o == nil || IsNil(o.IpRanges) { + var ret []string + return ret + } + return o.IpRanges +} + +// GetIpRangesOk returns a tuple with the IpRanges field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfUpdateInput) GetIpRangesOk() ([]string, bool) { + if o == nil || IsNil(o.IpRanges) { + return nil, false + } + return o.IpRanges, true +} + +// HasIpRanges returns a boolean if a field has been set. +func (o *VrfUpdateInput) HasIpRanges() bool { + if o != nil && !IsNil(o.IpRanges) { + return true + } + + return false +} + +// SetIpRanges gets a reference to the given []string and assigns it to the IpRanges field. +func (o *VrfUpdateInput) SetIpRanges(v []string) { + o.IpRanges = v +} + +// GetLocalAsn returns the LocalAsn field value if set, zero value otherwise. +func (o *VrfUpdateInput) GetLocalAsn() int32 { + if o == nil || IsNil(o.LocalAsn) { + var ret int32 + return ret + } + return *o.LocalAsn +} + +// GetLocalAsnOk returns a tuple with the LocalAsn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfUpdateInput) GetLocalAsnOk() (*int32, bool) { + if o == nil || IsNil(o.LocalAsn) { + return nil, false + } + return o.LocalAsn, true +} + +// HasLocalAsn returns a boolean if a field has been set. +func (o *VrfUpdateInput) HasLocalAsn() bool { + if o != nil && !IsNil(o.LocalAsn) { + return true + } + + return false +} + +// SetLocalAsn gets a reference to the given int32 and assigns it to the LocalAsn field. +func (o *VrfUpdateInput) SetLocalAsn(v int32) { + o.LocalAsn = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VrfUpdateInput) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfUpdateInput) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *VrfUpdateInput) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VrfUpdateInput) SetName(v string) { + o.Name = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VrfUpdateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfUpdateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VrfUpdateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VrfUpdateInput) SetTags(v []string) { + o.Tags = v +} + +func (o VrfUpdateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfUpdateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BgpDynamicNeighborsEnabled) { + toSerialize["bgp_dynamic_neighbors_enabled"] = o.BgpDynamicNeighborsEnabled + } + if !IsNil(o.BgpDynamicNeighborsExportRouteMap) { + toSerialize["bgp_dynamic_neighbors_export_route_map"] = o.BgpDynamicNeighborsExportRouteMap + } + if !IsNil(o.BgpDynamicNeighborsBfdEnabled) { + toSerialize["bgp_dynamic_neighbors_bfd_enabled"] = o.BgpDynamicNeighborsBfdEnabled + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.IpRanges) { + toSerialize["ip_ranges"] = o.IpRanges + } + if !IsNil(o.LocalAsn) { + toSerialize["local_asn"] = o.LocalAsn + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfUpdateInput) UnmarshalJSON(data []byte) (err error) { + varVrfUpdateInput := _VrfUpdateInput{} + + err = json.Unmarshal(data, &varVrfUpdateInput) + + if err != nil { + return err + } + + *o = VrfUpdateInput(varVrfUpdateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bgp_dynamic_neighbors_enabled") + delete(additionalProperties, "bgp_dynamic_neighbors_export_route_map") + delete(additionalProperties, "bgp_dynamic_neighbors_bfd_enabled") + delete(additionalProperties, "description") + delete(additionalProperties, "ip_ranges") + delete(additionalProperties, "local_asn") + delete(additionalProperties, "name") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfUpdateInput struct { + value *VrfUpdateInput + isSet bool +} + +func (v NullableVrfUpdateInput) Get() *VrfUpdateInput { + return v.value +} + +func (v *NullableVrfUpdateInput) Set(val *VrfUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVrfUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfUpdateInput(val *VrfUpdateInput) *NullableVrfUpdateInput { + return &NullableVrfUpdateInput{value: val, isSet: true} +} + +func (v NullableVrfUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit.go new file mode 100644 index 00000000..bf197e9a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit.go @@ -0,0 +1,803 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the VrfVirtualCircuit type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfVirtualCircuit{} + +// VrfVirtualCircuit struct for VrfVirtualCircuit +type VrfVirtualCircuit struct { + // An IP address from the subnet that will be used on the Customer side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Metal IP. By default, the last usable IP address in the subnet will be used. + CustomerIp *string `json:"customer_ip,omitempty"` + Description *string `json:"description,omitempty"` + Id *string `json:"id,omitempty"` + // The MD5 password for the BGP peering in plaintext (not a checksum). + Md5 *string `json:"md5,omitempty"` + // An IP address from the subnet that will be used on the Metal side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Customer IP. By default, the first usable IP address in the subnet will be used. + MetalIp *string `json:"metal_ip,omitempty"` + Name *string `json:"name,omitempty"` + Port *Href `json:"port,omitempty"` + NniVlan *int32 `json:"nni_vlan,omitempty"` + // The peer ASN that will be used with the VRF on the Virtual Circuit. + PeerAsn *int32 `json:"peer_asn,omitempty"` + Project *Href `json:"project,omitempty"` + // integer representing bps speed + Speed *int64 `json:"speed,omitempty"` + Status *VrfVirtualCircuitStatus `json:"status,omitempty"` + // The /30 or /31 subnet of one of the VRF IP Blocks that will be used with the VRF for the Virtual Circuit. This subnet does not have to be an existing VRF IP reservation, as we will create the VRF IP reservation on creation if it does not exist. The Metal IP and Customer IP must be IPs from this subnet. For /30 subnets, the network and broadcast IPs cannot be used as the Metal or Customer IP. + Subnet *string `json:"subnet,omitempty"` + Tags []string `json:"tags,omitempty"` + Type *VrfIpReservationType `json:"type,omitempty"` + Vrf Vrf `json:"vrf"` + CreatedAt *time.Time `json:"created_at,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfVirtualCircuit VrfVirtualCircuit + +// NewVrfVirtualCircuit instantiates a new VrfVirtualCircuit object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfVirtualCircuit(vrf Vrf) *VrfVirtualCircuit { + this := VrfVirtualCircuit{} + this.Vrf = vrf + return &this +} + +// NewVrfVirtualCircuitWithDefaults instantiates a new VrfVirtualCircuit object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfVirtualCircuitWithDefaults() *VrfVirtualCircuit { + this := VrfVirtualCircuit{} + return &this +} + +// GetCustomerIp returns the CustomerIp field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetCustomerIp() string { + if o == nil || IsNil(o.CustomerIp) { + var ret string + return ret + } + return *o.CustomerIp +} + +// GetCustomerIpOk returns a tuple with the CustomerIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetCustomerIpOk() (*string, bool) { + if o == nil || IsNil(o.CustomerIp) { + return nil, false + } + return o.CustomerIp, true +} + +// HasCustomerIp returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasCustomerIp() bool { + if o != nil && !IsNil(o.CustomerIp) { + return true + } + + return false +} + +// SetCustomerIp gets a reference to the given string and assigns it to the CustomerIp field. +func (o *VrfVirtualCircuit) SetCustomerIp(v string) { + o.CustomerIp = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VrfVirtualCircuit) SetDescription(v string) { + o.Description = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *VrfVirtualCircuit) SetId(v string) { + o.Id = &v +} + +// GetMd5 returns the Md5 field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetMd5() string { + if o == nil || IsNil(o.Md5) { + var ret string + return ret + } + return *o.Md5 +} + +// GetMd5Ok returns a tuple with the Md5 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetMd5Ok() (*string, bool) { + if o == nil || IsNil(o.Md5) { + return nil, false + } + return o.Md5, true +} + +// HasMd5 returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasMd5() bool { + if o != nil && !IsNil(o.Md5) { + return true + } + + return false +} + +// SetMd5 gets a reference to the given string and assigns it to the Md5 field. +func (o *VrfVirtualCircuit) SetMd5(v string) { + o.Md5 = &v +} + +// GetMetalIp returns the MetalIp field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetMetalIp() string { + if o == nil || IsNil(o.MetalIp) { + var ret string + return ret + } + return *o.MetalIp +} + +// GetMetalIpOk returns a tuple with the MetalIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetMetalIpOk() (*string, bool) { + if o == nil || IsNil(o.MetalIp) { + return nil, false + } + return o.MetalIp, true +} + +// HasMetalIp returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasMetalIp() bool { + if o != nil && !IsNil(o.MetalIp) { + return true + } + + return false +} + +// SetMetalIp gets a reference to the given string and assigns it to the MetalIp field. +func (o *VrfVirtualCircuit) SetMetalIp(v string) { + o.MetalIp = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VrfVirtualCircuit) SetName(v string) { + o.Name = &v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetPort() Href { + if o == nil || IsNil(o.Port) { + var ret Href + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetPortOk() (*Href, bool) { + if o == nil || IsNil(o.Port) { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasPort() bool { + if o != nil && !IsNil(o.Port) { + return true + } + + return false +} + +// SetPort gets a reference to the given Href and assigns it to the Port field. +func (o *VrfVirtualCircuit) SetPort(v Href) { + o.Port = &v +} + +// GetNniVlan returns the NniVlan field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetNniVlan() int32 { + if o == nil || IsNil(o.NniVlan) { + var ret int32 + return ret + } + return *o.NniVlan +} + +// GetNniVlanOk returns a tuple with the NniVlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetNniVlanOk() (*int32, bool) { + if o == nil || IsNil(o.NniVlan) { + return nil, false + } + return o.NniVlan, true +} + +// HasNniVlan returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasNniVlan() bool { + if o != nil && !IsNil(o.NniVlan) { + return true + } + + return false +} + +// SetNniVlan gets a reference to the given int32 and assigns it to the NniVlan field. +func (o *VrfVirtualCircuit) SetNniVlan(v int32) { + o.NniVlan = &v +} + +// GetPeerAsn returns the PeerAsn field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetPeerAsn() int32 { + if o == nil || IsNil(o.PeerAsn) { + var ret int32 + return ret + } + return *o.PeerAsn +} + +// GetPeerAsnOk returns a tuple with the PeerAsn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetPeerAsnOk() (*int32, bool) { + if o == nil || IsNil(o.PeerAsn) { + return nil, false + } + return o.PeerAsn, true +} + +// HasPeerAsn returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasPeerAsn() bool { + if o != nil && !IsNil(o.PeerAsn) { + return true + } + + return false +} + +// SetPeerAsn gets a reference to the given int32 and assigns it to the PeerAsn field. +func (o *VrfVirtualCircuit) SetPeerAsn(v int32) { + o.PeerAsn = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetProject() Href { + if o == nil || IsNil(o.Project) { + var ret Href + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetProjectOk() (*Href, bool) { + if o == nil || IsNil(o.Project) { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasProject() bool { + if o != nil && !IsNil(o.Project) { + return true + } + + return false +} + +// SetProject gets a reference to the given Href and assigns it to the Project field. +func (o *VrfVirtualCircuit) SetProject(v Href) { + o.Project = &v +} + +// GetSpeed returns the Speed field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetSpeed() int64 { + if o == nil || IsNil(o.Speed) { + var ret int64 + return ret + } + return *o.Speed +} + +// GetSpeedOk returns a tuple with the Speed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetSpeedOk() (*int64, bool) { + if o == nil || IsNil(o.Speed) { + return nil, false + } + return o.Speed, true +} + +// HasSpeed returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasSpeed() bool { + if o != nil && !IsNil(o.Speed) { + return true + } + + return false +} + +// SetSpeed gets a reference to the given int64 and assigns it to the Speed field. +func (o *VrfVirtualCircuit) SetSpeed(v int64) { + o.Speed = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetStatus() VrfVirtualCircuitStatus { + if o == nil || IsNil(o.Status) { + var ret VrfVirtualCircuitStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetStatusOk() (*VrfVirtualCircuitStatus, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given VrfVirtualCircuitStatus and assigns it to the Status field. +func (o *VrfVirtualCircuit) SetStatus(v VrfVirtualCircuitStatus) { + o.Status = &v +} + +// GetSubnet returns the Subnet field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetSubnet() string { + if o == nil || IsNil(o.Subnet) { + var ret string + return ret + } + return *o.Subnet +} + +// GetSubnetOk returns a tuple with the Subnet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetSubnetOk() (*string, bool) { + if o == nil || IsNil(o.Subnet) { + return nil, false + } + return o.Subnet, true +} + +// HasSubnet returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasSubnet() bool { + if o != nil && !IsNil(o.Subnet) { + return true + } + + return false +} + +// SetSubnet gets a reference to the given string and assigns it to the Subnet field. +func (o *VrfVirtualCircuit) SetSubnet(v string) { + o.Subnet = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VrfVirtualCircuit) SetTags(v []string) { + o.Tags = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetType() VrfIpReservationType { + if o == nil || IsNil(o.Type) { + var ret VrfIpReservationType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetTypeOk() (*VrfIpReservationType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given VrfIpReservationType and assigns it to the Type field. +func (o *VrfVirtualCircuit) SetType(v VrfIpReservationType) { + o.Type = &v +} + +// GetVrf returns the Vrf field value +func (o *VrfVirtualCircuit) GetVrf() Vrf { + if o == nil { + var ret Vrf + return ret + } + + return o.Vrf +} + +// GetVrfOk returns a tuple with the Vrf field value +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetVrfOk() (*Vrf, bool) { + if o == nil { + return nil, false + } + return &o.Vrf, true +} + +// SetVrf sets field value +func (o *VrfVirtualCircuit) SetVrf(v Vrf) { + o.Vrf = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *VrfVirtualCircuit) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *VrfVirtualCircuit) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuit) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *VrfVirtualCircuit) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *VrfVirtualCircuit) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o VrfVirtualCircuit) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfVirtualCircuit) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomerIp) { + toSerialize["customer_ip"] = o.CustomerIp + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Md5) { + toSerialize["md5"] = o.Md5 + } + if !IsNil(o.MetalIp) { + toSerialize["metal_ip"] = o.MetalIp + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Port) { + toSerialize["port"] = o.Port + } + if !IsNil(o.NniVlan) { + toSerialize["nni_vlan"] = o.NniVlan + } + if !IsNil(o.PeerAsn) { + toSerialize["peer_asn"] = o.PeerAsn + } + if !IsNil(o.Project) { + toSerialize["project"] = o.Project + } + if !IsNil(o.Speed) { + toSerialize["speed"] = o.Speed + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.Subnet) { + toSerialize["subnet"] = o.Subnet + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + toSerialize["vrf"] = o.Vrf + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfVirtualCircuit) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "vrf", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVrfVirtualCircuit := _VrfVirtualCircuit{} + + err = json.Unmarshal(data, &varVrfVirtualCircuit) + + if err != nil { + return err + } + + *o = VrfVirtualCircuit(varVrfVirtualCircuit) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "customer_ip") + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "md5") + delete(additionalProperties, "metal_ip") + delete(additionalProperties, "name") + delete(additionalProperties, "port") + delete(additionalProperties, "nni_vlan") + delete(additionalProperties, "peer_asn") + delete(additionalProperties, "project") + delete(additionalProperties, "speed") + delete(additionalProperties, "status") + delete(additionalProperties, "subnet") + delete(additionalProperties, "tags") + delete(additionalProperties, "type") + delete(additionalProperties, "vrf") + delete(additionalProperties, "created_at") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfVirtualCircuit struct { + value *VrfVirtualCircuit + isSet bool +} + +func (v NullableVrfVirtualCircuit) Get() *VrfVirtualCircuit { + return v.value +} + +func (v *NullableVrfVirtualCircuit) Set(val *VrfVirtualCircuit) { + v.value = val + v.isSet = true +} + +func (v NullableVrfVirtualCircuit) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfVirtualCircuit) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfVirtualCircuit(val *VrfVirtualCircuit) *NullableVrfVirtualCircuit { + return &NullableVrfVirtualCircuit{value: val, isSet: true} +} + +func (v NullableVrfVirtualCircuit) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfVirtualCircuit) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_create_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_create_input.go new file mode 100644 index 00000000..1495546b --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_create_input.go @@ -0,0 +1,560 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// checks if the VrfVirtualCircuitCreateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfVirtualCircuitCreateInput{} + +// VrfVirtualCircuitCreateInput struct for VrfVirtualCircuitCreateInput +type VrfVirtualCircuitCreateInput struct { + // An IP address from the subnet that will be used on the Customer side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Metal IP. By default, the last usable IP address in the subnet will be used. + CustomerIp *string `json:"customer_ip,omitempty"` + Description *string `json:"description,omitempty"` + // The plaintext BGP peering password shared by neighbors as an MD5 checksum: * must be 10-20 characters long * may not include punctuation * must be a combination of numbers and letters * must contain at least one lowercase, uppercase, and digit character + Md5 NullableString `json:"md5,omitempty"` + // An IP address from the subnet that will be used on the Metal side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Customer IP. By default, the first usable IP address in the subnet will be used. + MetalIp *string `json:"metal_ip,omitempty"` + Name *string `json:"name,omitempty"` + NniVlan int32 `json:"nni_vlan"` + // The peer ASN that will be used with the VRF on the Virtual Circuit. + PeerAsn int32 `json:"peer_asn"` + ProjectId string `json:"project_id"` + // speed can be passed as integer number representing bps speed or string (e.g. '52m' or '100g' or '4 gbps') + Speed *int32 `json:"speed,omitempty"` + // The /30 or /31 subnet of one of the VRF IP Blocks that will be used with the VRF for the Virtual Circuit. This subnet does not have to be an existing VRF IP reservation, as we will create the VRF IP reservation on creation if it does not exist. The Metal IP and Customer IP must be IPs from this subnet. For /30 subnets, the network and broadcast IPs cannot be used as the Metal or Customer IP. The subnet specified must be contained within an already-defined IP Range for the VRF. + Subnet string `json:"subnet"` + Tags []string `json:"tags,omitempty"` + // The UUID of the VRF that will be associated with the Virtual Circuit. + Vrf string `json:"vrf"` + AdditionalProperties map[string]interface{} +} + +type _VrfVirtualCircuitCreateInput VrfVirtualCircuitCreateInput + +// NewVrfVirtualCircuitCreateInput instantiates a new VrfVirtualCircuitCreateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfVirtualCircuitCreateInput(nniVlan int32, peerAsn int32, projectId string, subnet string, vrf string) *VrfVirtualCircuitCreateInput { + this := VrfVirtualCircuitCreateInput{} + this.NniVlan = nniVlan + this.PeerAsn = peerAsn + this.ProjectId = projectId + this.Subnet = subnet + this.Vrf = vrf + return &this +} + +// NewVrfVirtualCircuitCreateInputWithDefaults instantiates a new VrfVirtualCircuitCreateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfVirtualCircuitCreateInputWithDefaults() *VrfVirtualCircuitCreateInput { + this := VrfVirtualCircuitCreateInput{} + return &this +} + +// GetCustomerIp returns the CustomerIp field value if set, zero value otherwise. +func (o *VrfVirtualCircuitCreateInput) GetCustomerIp() string { + if o == nil || IsNil(o.CustomerIp) { + var ret string + return ret + } + return *o.CustomerIp +} + +// GetCustomerIpOk returns a tuple with the CustomerIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitCreateInput) GetCustomerIpOk() (*string, bool) { + if o == nil || IsNil(o.CustomerIp) { + return nil, false + } + return o.CustomerIp, true +} + +// HasCustomerIp returns a boolean if a field has been set. +func (o *VrfVirtualCircuitCreateInput) HasCustomerIp() bool { + if o != nil && !IsNil(o.CustomerIp) { + return true + } + + return false +} + +// SetCustomerIp gets a reference to the given string and assigns it to the CustomerIp field. +func (o *VrfVirtualCircuitCreateInput) SetCustomerIp(v string) { + o.CustomerIp = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VrfVirtualCircuitCreateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitCreateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VrfVirtualCircuitCreateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VrfVirtualCircuitCreateInput) SetDescription(v string) { + o.Description = &v +} + +// GetMd5 returns the Md5 field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *VrfVirtualCircuitCreateInput) GetMd5() string { + if o == nil || IsNil(o.Md5.Get()) { + var ret string + return ret + } + return *o.Md5.Get() +} + +// GetMd5Ok returns a tuple with the Md5 field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VrfVirtualCircuitCreateInput) GetMd5Ok() (*string, bool) { + if o == nil { + return nil, false + } + return o.Md5.Get(), o.Md5.IsSet() +} + +// HasMd5 returns a boolean if a field has been set. +func (o *VrfVirtualCircuitCreateInput) HasMd5() bool { + if o != nil && o.Md5.IsSet() { + return true + } + + return false +} + +// SetMd5 gets a reference to the given NullableString and assigns it to the Md5 field. +func (o *VrfVirtualCircuitCreateInput) SetMd5(v string) { + o.Md5.Set(&v) +} + +// SetMd5Nil sets the value for Md5 to be an explicit nil +func (o *VrfVirtualCircuitCreateInput) SetMd5Nil() { + o.Md5.Set(nil) +} + +// UnsetMd5 ensures that no value is present for Md5, not even an explicit nil +func (o *VrfVirtualCircuitCreateInput) UnsetMd5() { + o.Md5.Unset() +} + +// GetMetalIp returns the MetalIp field value if set, zero value otherwise. +func (o *VrfVirtualCircuitCreateInput) GetMetalIp() string { + if o == nil || IsNil(o.MetalIp) { + var ret string + return ret + } + return *o.MetalIp +} + +// GetMetalIpOk returns a tuple with the MetalIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitCreateInput) GetMetalIpOk() (*string, bool) { + if o == nil || IsNil(o.MetalIp) { + return nil, false + } + return o.MetalIp, true +} + +// HasMetalIp returns a boolean if a field has been set. +func (o *VrfVirtualCircuitCreateInput) HasMetalIp() bool { + if o != nil && !IsNil(o.MetalIp) { + return true + } + + return false +} + +// SetMetalIp gets a reference to the given string and assigns it to the MetalIp field. +func (o *VrfVirtualCircuitCreateInput) SetMetalIp(v string) { + o.MetalIp = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VrfVirtualCircuitCreateInput) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitCreateInput) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *VrfVirtualCircuitCreateInput) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VrfVirtualCircuitCreateInput) SetName(v string) { + o.Name = &v +} + +// GetNniVlan returns the NniVlan field value +func (o *VrfVirtualCircuitCreateInput) GetNniVlan() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NniVlan +} + +// GetNniVlanOk returns a tuple with the NniVlan field value +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitCreateInput) GetNniVlanOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NniVlan, true +} + +// SetNniVlan sets field value +func (o *VrfVirtualCircuitCreateInput) SetNniVlan(v int32) { + o.NniVlan = v +} + +// GetPeerAsn returns the PeerAsn field value +func (o *VrfVirtualCircuitCreateInput) GetPeerAsn() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PeerAsn +} + +// GetPeerAsnOk returns a tuple with the PeerAsn field value +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitCreateInput) GetPeerAsnOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PeerAsn, true +} + +// SetPeerAsn sets field value +func (o *VrfVirtualCircuitCreateInput) SetPeerAsn(v int32) { + o.PeerAsn = v +} + +// GetProjectId returns the ProjectId field value +func (o *VrfVirtualCircuitCreateInput) GetProjectId() string { + if o == nil { + var ret string + return ret + } + + return o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitCreateInput) GetProjectIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ProjectId, true +} + +// SetProjectId sets field value +func (o *VrfVirtualCircuitCreateInput) SetProjectId(v string) { + o.ProjectId = v +} + +// GetSpeed returns the Speed field value if set, zero value otherwise. +func (o *VrfVirtualCircuitCreateInput) GetSpeed() int32 { + if o == nil || IsNil(o.Speed) { + var ret int32 + return ret + } + return *o.Speed +} + +// GetSpeedOk returns a tuple with the Speed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitCreateInput) GetSpeedOk() (*int32, bool) { + if o == nil || IsNil(o.Speed) { + return nil, false + } + return o.Speed, true +} + +// HasSpeed returns a boolean if a field has been set. +func (o *VrfVirtualCircuitCreateInput) HasSpeed() bool { + if o != nil && !IsNil(o.Speed) { + return true + } + + return false +} + +// SetSpeed gets a reference to the given int32 and assigns it to the Speed field. +func (o *VrfVirtualCircuitCreateInput) SetSpeed(v int32) { + o.Speed = &v +} + +// GetSubnet returns the Subnet field value +func (o *VrfVirtualCircuitCreateInput) GetSubnet() string { + if o == nil { + var ret string + return ret + } + + return o.Subnet +} + +// GetSubnetOk returns a tuple with the Subnet field value +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitCreateInput) GetSubnetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subnet, true +} + +// SetSubnet sets field value +func (o *VrfVirtualCircuitCreateInput) SetSubnet(v string) { + o.Subnet = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VrfVirtualCircuitCreateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitCreateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VrfVirtualCircuitCreateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VrfVirtualCircuitCreateInput) SetTags(v []string) { + o.Tags = v +} + +// GetVrf returns the Vrf field value +func (o *VrfVirtualCircuitCreateInput) GetVrf() string { + if o == nil { + var ret string + return ret + } + + return o.Vrf +} + +// GetVrfOk returns a tuple with the Vrf field value +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitCreateInput) GetVrfOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Vrf, true +} + +// SetVrf sets field value +func (o *VrfVirtualCircuitCreateInput) SetVrf(v string) { + o.Vrf = v +} + +func (o VrfVirtualCircuitCreateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfVirtualCircuitCreateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomerIp) { + toSerialize["customer_ip"] = o.CustomerIp + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if o.Md5.IsSet() { + toSerialize["md5"] = o.Md5.Get() + } + if !IsNil(o.MetalIp) { + toSerialize["metal_ip"] = o.MetalIp + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["nni_vlan"] = o.NniVlan + toSerialize["peer_asn"] = o.PeerAsn + toSerialize["project_id"] = o.ProjectId + if !IsNil(o.Speed) { + toSerialize["speed"] = o.Speed + } + toSerialize["subnet"] = o.Subnet + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + toSerialize["vrf"] = o.Vrf + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfVirtualCircuitCreateInput) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "nni_vlan", + "peer_asn", + "project_id", + "subnet", + "vrf", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVrfVirtualCircuitCreateInput := _VrfVirtualCircuitCreateInput{} + + err = json.Unmarshal(data, &varVrfVirtualCircuitCreateInput) + + if err != nil { + return err + } + + *o = VrfVirtualCircuitCreateInput(varVrfVirtualCircuitCreateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "customer_ip") + delete(additionalProperties, "description") + delete(additionalProperties, "md5") + delete(additionalProperties, "metal_ip") + delete(additionalProperties, "name") + delete(additionalProperties, "nni_vlan") + delete(additionalProperties, "peer_asn") + delete(additionalProperties, "project_id") + delete(additionalProperties, "speed") + delete(additionalProperties, "subnet") + delete(additionalProperties, "tags") + delete(additionalProperties, "vrf") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfVirtualCircuitCreateInput struct { + value *VrfVirtualCircuitCreateInput + isSet bool +} + +func (v NullableVrfVirtualCircuitCreateInput) Get() *VrfVirtualCircuitCreateInput { + return v.value +} + +func (v *NullableVrfVirtualCircuitCreateInput) Set(val *VrfVirtualCircuitCreateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVrfVirtualCircuitCreateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfVirtualCircuitCreateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfVirtualCircuitCreateInput(val *VrfVirtualCircuitCreateInput) *NullableVrfVirtualCircuitCreateInput { + return &NullableVrfVirtualCircuitCreateInput{value: val, isSet: true} +} + +func (v NullableVrfVirtualCircuitCreateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfVirtualCircuitCreateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_status.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_status.go new file mode 100644 index 00000000..f1a91bc9 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_status.go @@ -0,0 +1,131 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "fmt" +) + +// VrfVirtualCircuitStatus The status changes of a VRF virtual circuit are generally the same as Virtual Circuits that aren't in a VRF. However, for VRF Virtual Circuits on Fabric VCs, the status will change to 'waiting_on_peering_details' once the Fabric service token associated with the virtual circuit has been redeemed on Fabric, and Metal has found the associated Fabric connection. At this point, users can update the subnet, MD5 password, customer IP and/or metal IP accordingly. For VRF Virtual Circuits on Dedicated Ports, we require all peering details to be set on creation of a VRF Virtual Circuit. The status will change to `changing_peering_details` whenever an active VRF Virtual Circuit has any of its peering details updated. +type VrfVirtualCircuitStatus string + +// List of VrfVirtualCircuit_status +const ( + VRFVIRTUALCIRCUITSTATUS_PENDING VrfVirtualCircuitStatus = "pending" + VRFVIRTUALCIRCUITSTATUS_WAITING_ON_PEERING_DETAILS VrfVirtualCircuitStatus = "waiting_on_peering_details" + VRFVIRTUALCIRCUITSTATUS_ACTIVATING VrfVirtualCircuitStatus = "activating" + VRFVIRTUALCIRCUITSTATUS_CHANGING_PEERING_DETAILS VrfVirtualCircuitStatus = "changing_peering_details" + VRFVIRTUALCIRCUITSTATUS_DEACTIVATING VrfVirtualCircuitStatus = "deactivating" + VRFVIRTUALCIRCUITSTATUS_DELETING VrfVirtualCircuitStatus = "deleting" + VRFVIRTUALCIRCUITSTATUS_ACTIVE VrfVirtualCircuitStatus = "active" + VRFVIRTUALCIRCUITSTATUS_EXPIRED VrfVirtualCircuitStatus = "expired" + VRFVIRTUALCIRCUITSTATUS_ACTIVATION_FAILED VrfVirtualCircuitStatus = "activation_failed" + VRFVIRTUALCIRCUITSTATUS_CHANGING_PEERING_DETAILS_FAILED VrfVirtualCircuitStatus = "changing_peering_details_failed" + VRFVIRTUALCIRCUITSTATUS_DEACTIVATION_FAILED VrfVirtualCircuitStatus = "deactivation_failed" + VRFVIRTUALCIRCUITSTATUS_DELETE_FAILED VrfVirtualCircuitStatus = "delete_failed" +) + +// All allowed values of VrfVirtualCircuitStatus enum +var AllowedVrfVirtualCircuitStatusEnumValues = []VrfVirtualCircuitStatus{ + "pending", + "waiting_on_peering_details", + "activating", + "changing_peering_details", + "deactivating", + "deleting", + "active", + "expired", + "activation_failed", + "changing_peering_details_failed", + "deactivation_failed", + "delete_failed", +} + +func (v *VrfVirtualCircuitStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VrfVirtualCircuitStatus(value) + for _, existing := range AllowedVrfVirtualCircuitStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid VrfVirtualCircuitStatus", value) +} + +// NewVrfVirtualCircuitStatusFromValue returns a pointer to a valid VrfVirtualCircuitStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVrfVirtualCircuitStatusFromValue(v string) (*VrfVirtualCircuitStatus, error) { + ev := VrfVirtualCircuitStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VrfVirtualCircuitStatus: valid values are %v", v, AllowedVrfVirtualCircuitStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VrfVirtualCircuitStatus) IsValid() bool { + for _, existing := range AllowedVrfVirtualCircuitStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VrfVirtualCircuit_status value +func (v VrfVirtualCircuitStatus) Ptr() *VrfVirtualCircuitStatus { + return &v +} + +type NullableVrfVirtualCircuitStatus struct { + value *VrfVirtualCircuitStatus + isSet bool +} + +func (v NullableVrfVirtualCircuitStatus) Get() *VrfVirtualCircuitStatus { + return v.value +} + +func (v *NullableVrfVirtualCircuitStatus) Set(val *VrfVirtualCircuitStatus) { + v.value = val + v.isSet = true +} + +func (v NullableVrfVirtualCircuitStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfVirtualCircuitStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfVirtualCircuitStatus(val *VrfVirtualCircuitStatus) *NullableVrfVirtualCircuitStatus { + return &NullableVrfVirtualCircuitStatus{value: val, isSet: true} +} + +func (v NullableVrfVirtualCircuitStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfVirtualCircuitStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_update_input.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_update_input.go new file mode 100644 index 00000000..04e21dd0 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/model_vrf_virtual_circuit_update_input.go @@ -0,0 +1,456 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" +) + +// checks if the VrfVirtualCircuitUpdateInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VrfVirtualCircuitUpdateInput{} + +// VrfVirtualCircuitUpdateInput struct for VrfVirtualCircuitUpdateInput +type VrfVirtualCircuitUpdateInput struct { + // An IP address from the subnet that will be used on the Customer side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Metal IP. By default, the last usable IP address in the subnet will be used. + CustomerIp *string `json:"customer_ip,omitempty"` + Description *string `json:"description,omitempty"` + // The plaintext BGP peering password shared by neighbors as an MD5 checksum: * must be 10-20 characters long * may not include punctuation * must be a combination of numbers and letters * must contain at least one lowercase, uppercase, and digit character + Md5 *string `json:"md5,omitempty"` + // An IP address from the subnet that will be used on the Metal side. This parameter is optional, but if supplied, we will use the other usable IP address in the subnet as the Customer IP. By default, the first usable IP address in the subnet will be used. + MetalIp *string `json:"metal_ip,omitempty"` + Name *string `json:"name,omitempty"` + // The peer ASN that will be used with the VRF on the Virtual Circuit. + PeerAsn *int32 `json:"peer_asn,omitempty"` + // Speed can be changed only if it is an interconnection on a Dedicated Port + Speed *string `json:"speed,omitempty"` + // The /30 or /31 subnet of one of the VRF IP Blocks that will be used with the VRF for the Virtual Circuit. This subnet does not have to be an existing VRF IP reservation, as we will create the VRF IP reservation on creation if it does not exist. The Metal IP and Customer IP must be IPs from this subnet. For /30 subnets, the network and broadcast IPs cannot be used as the Metal or Customer IP. + Subnet *string `json:"subnet,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VrfVirtualCircuitUpdateInput VrfVirtualCircuitUpdateInput + +// NewVrfVirtualCircuitUpdateInput instantiates a new VrfVirtualCircuitUpdateInput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVrfVirtualCircuitUpdateInput() *VrfVirtualCircuitUpdateInput { + this := VrfVirtualCircuitUpdateInput{} + return &this +} + +// NewVrfVirtualCircuitUpdateInputWithDefaults instantiates a new VrfVirtualCircuitUpdateInput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVrfVirtualCircuitUpdateInputWithDefaults() *VrfVirtualCircuitUpdateInput { + this := VrfVirtualCircuitUpdateInput{} + return &this +} + +// GetCustomerIp returns the CustomerIp field value if set, zero value otherwise. +func (o *VrfVirtualCircuitUpdateInput) GetCustomerIp() string { + if o == nil || IsNil(o.CustomerIp) { + var ret string + return ret + } + return *o.CustomerIp +} + +// GetCustomerIpOk returns a tuple with the CustomerIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitUpdateInput) GetCustomerIpOk() (*string, bool) { + if o == nil || IsNil(o.CustomerIp) { + return nil, false + } + return o.CustomerIp, true +} + +// HasCustomerIp returns a boolean if a field has been set. +func (o *VrfVirtualCircuitUpdateInput) HasCustomerIp() bool { + if o != nil && !IsNil(o.CustomerIp) { + return true + } + + return false +} + +// SetCustomerIp gets a reference to the given string and assigns it to the CustomerIp field. +func (o *VrfVirtualCircuitUpdateInput) SetCustomerIp(v string) { + o.CustomerIp = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VrfVirtualCircuitUpdateInput) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitUpdateInput) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *VrfVirtualCircuitUpdateInput) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VrfVirtualCircuitUpdateInput) SetDescription(v string) { + o.Description = &v +} + +// GetMd5 returns the Md5 field value if set, zero value otherwise. +func (o *VrfVirtualCircuitUpdateInput) GetMd5() string { + if o == nil || IsNil(o.Md5) { + var ret string + return ret + } + return *o.Md5 +} + +// GetMd5Ok returns a tuple with the Md5 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitUpdateInput) GetMd5Ok() (*string, bool) { + if o == nil || IsNil(o.Md5) { + return nil, false + } + return o.Md5, true +} + +// HasMd5 returns a boolean if a field has been set. +func (o *VrfVirtualCircuitUpdateInput) HasMd5() bool { + if o != nil && !IsNil(o.Md5) { + return true + } + + return false +} + +// SetMd5 gets a reference to the given string and assigns it to the Md5 field. +func (o *VrfVirtualCircuitUpdateInput) SetMd5(v string) { + o.Md5 = &v +} + +// GetMetalIp returns the MetalIp field value if set, zero value otherwise. +func (o *VrfVirtualCircuitUpdateInput) GetMetalIp() string { + if o == nil || IsNil(o.MetalIp) { + var ret string + return ret + } + return *o.MetalIp +} + +// GetMetalIpOk returns a tuple with the MetalIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitUpdateInput) GetMetalIpOk() (*string, bool) { + if o == nil || IsNil(o.MetalIp) { + return nil, false + } + return o.MetalIp, true +} + +// HasMetalIp returns a boolean if a field has been set. +func (o *VrfVirtualCircuitUpdateInput) HasMetalIp() bool { + if o != nil && !IsNil(o.MetalIp) { + return true + } + + return false +} + +// SetMetalIp gets a reference to the given string and assigns it to the MetalIp field. +func (o *VrfVirtualCircuitUpdateInput) SetMetalIp(v string) { + o.MetalIp = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VrfVirtualCircuitUpdateInput) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitUpdateInput) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *VrfVirtualCircuitUpdateInput) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VrfVirtualCircuitUpdateInput) SetName(v string) { + o.Name = &v +} + +// GetPeerAsn returns the PeerAsn field value if set, zero value otherwise. +func (o *VrfVirtualCircuitUpdateInput) GetPeerAsn() int32 { + if o == nil || IsNil(o.PeerAsn) { + var ret int32 + return ret + } + return *o.PeerAsn +} + +// GetPeerAsnOk returns a tuple with the PeerAsn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitUpdateInput) GetPeerAsnOk() (*int32, bool) { + if o == nil || IsNil(o.PeerAsn) { + return nil, false + } + return o.PeerAsn, true +} + +// HasPeerAsn returns a boolean if a field has been set. +func (o *VrfVirtualCircuitUpdateInput) HasPeerAsn() bool { + if o != nil && !IsNil(o.PeerAsn) { + return true + } + + return false +} + +// SetPeerAsn gets a reference to the given int32 and assigns it to the PeerAsn field. +func (o *VrfVirtualCircuitUpdateInput) SetPeerAsn(v int32) { + o.PeerAsn = &v +} + +// GetSpeed returns the Speed field value if set, zero value otherwise. +func (o *VrfVirtualCircuitUpdateInput) GetSpeed() string { + if o == nil || IsNil(o.Speed) { + var ret string + return ret + } + return *o.Speed +} + +// GetSpeedOk returns a tuple with the Speed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitUpdateInput) GetSpeedOk() (*string, bool) { + if o == nil || IsNil(o.Speed) { + return nil, false + } + return o.Speed, true +} + +// HasSpeed returns a boolean if a field has been set. +func (o *VrfVirtualCircuitUpdateInput) HasSpeed() bool { + if o != nil && !IsNil(o.Speed) { + return true + } + + return false +} + +// SetSpeed gets a reference to the given string and assigns it to the Speed field. +func (o *VrfVirtualCircuitUpdateInput) SetSpeed(v string) { + o.Speed = &v +} + +// GetSubnet returns the Subnet field value if set, zero value otherwise. +func (o *VrfVirtualCircuitUpdateInput) GetSubnet() string { + if o == nil || IsNil(o.Subnet) { + var ret string + return ret + } + return *o.Subnet +} + +// GetSubnetOk returns a tuple with the Subnet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitUpdateInput) GetSubnetOk() (*string, bool) { + if o == nil || IsNil(o.Subnet) { + return nil, false + } + return o.Subnet, true +} + +// HasSubnet returns a boolean if a field has been set. +func (o *VrfVirtualCircuitUpdateInput) HasSubnet() bool { + if o != nil && !IsNil(o.Subnet) { + return true + } + + return false +} + +// SetSubnet gets a reference to the given string and assigns it to the Subnet field. +func (o *VrfVirtualCircuitUpdateInput) SetSubnet(v string) { + o.Subnet = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *VrfVirtualCircuitUpdateInput) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VrfVirtualCircuitUpdateInput) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *VrfVirtualCircuitUpdateInput) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *VrfVirtualCircuitUpdateInput) SetTags(v []string) { + o.Tags = v +} + +func (o VrfVirtualCircuitUpdateInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VrfVirtualCircuitUpdateInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomerIp) { + toSerialize["customer_ip"] = o.CustomerIp + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Md5) { + toSerialize["md5"] = o.Md5 + } + if !IsNil(o.MetalIp) { + toSerialize["metal_ip"] = o.MetalIp + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.PeerAsn) { + toSerialize["peer_asn"] = o.PeerAsn + } + if !IsNil(o.Speed) { + toSerialize["speed"] = o.Speed + } + if !IsNil(o.Subnet) { + toSerialize["subnet"] = o.Subnet + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VrfVirtualCircuitUpdateInput) UnmarshalJSON(data []byte) (err error) { + varVrfVirtualCircuitUpdateInput := _VrfVirtualCircuitUpdateInput{} + + err = json.Unmarshal(data, &varVrfVirtualCircuitUpdateInput) + + if err != nil { + return err + } + + *o = VrfVirtualCircuitUpdateInput(varVrfVirtualCircuitUpdateInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "customer_ip") + delete(additionalProperties, "description") + delete(additionalProperties, "md5") + delete(additionalProperties, "metal_ip") + delete(additionalProperties, "name") + delete(additionalProperties, "peer_asn") + delete(additionalProperties, "speed") + delete(additionalProperties, "subnet") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVrfVirtualCircuitUpdateInput struct { + value *VrfVirtualCircuitUpdateInput + isSet bool +} + +func (v NullableVrfVirtualCircuitUpdateInput) Get() *VrfVirtualCircuitUpdateInput { + return v.value +} + +func (v *NullableVrfVirtualCircuitUpdateInput) Set(val *VrfVirtualCircuitUpdateInput) { + v.value = val + v.isSet = true +} + +func (v NullableVrfVirtualCircuitUpdateInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVrfVirtualCircuitUpdateInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVrfVirtualCircuitUpdateInput(val *VrfVirtualCircuitUpdateInput) *NullableVrfVirtualCircuitUpdateInput { + return &NullableVrfVirtualCircuitUpdateInput{value: val, isSet: true} +} + +func (v NullableVrfVirtualCircuitUpdateInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVrfVirtualCircuitUpdateInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/response.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/response.go new file mode 100644 index 00000000..46c8bbb4 --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/response.go @@ -0,0 +1,48 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/utils.go b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/utils.go new file mode 100644 index 00000000..4f8f8b1a --- /dev/null +++ b/vendor/github.com/equinix/equinix-sdk-go/services/metalv1/utils.go @@ -0,0 +1,348 @@ +/* +Metal API + +# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. + +API version: 1.0.0 +Contact: support@equinixmetal.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metalv1 + +import ( + "encoding/json" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} diff --git a/vendor/github.com/packethost/packngo/CHANGELOG.md b/vendor/github.com/packethost/packngo/CHANGELOG.md deleted file mode 100644 index 53b6de27..00000000 --- a/vendor/github.com/packethost/packngo/CHANGELOG.md +++ /dev/null @@ -1,12 +0,0 @@ -# Changelog - -This project adheres to [Semantic -Versioning](http://semver.org/spec/v2.0.0.html). - -All notable changes to this project will be documented at -. Drafts release notes may be -used to track features that will be available in future releases. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/), -breaking changes, additions, removals, and fixes should be pointed out in the -release notes. diff --git a/vendor/github.com/packethost/packngo/CONTRIBUTING.md b/vendor/github.com/packethost/packngo/CONTRIBUTING.md deleted file mode 100644 index 368e3a4a..00000000 --- a/vendor/github.com/packethost/packngo/CONTRIBUTING.md +++ /dev/null @@ -1,119 +0,0 @@ -# Contributing - -Thanks for your interest in improving this project! Before we get technical, -make sure you have reviewed the [code of conduct](code-of-conduct.md), -[Developer Certificate of Origin](DCO), and [OWNERS](OWNERS.md) files. Code will -be licensed according to [LICENSE.txt](LICENSE.txt). - -## Pull Requests - -When creating a pull request, please refer to an open issue. If there is no -issue open for the pull request you are creating, please create one. Frequently, -pull requests may be merged or closed while the underlying issue being addressed -is not fully addressed. Issues are a place to discuss the problem in need of a -solution. Pull requests are a place to discuss an implementation of one -particular answer to that problem. A pull request may not address all (or any) -of the problems expressed in the issue, so it is important to track these -separately. - -## Code Quality - -### Documentation - -All public functions and variables should include at least a short description -of the functionality they provide. Comments should be formatted according to -. - -Documentation at will be -generated from these comments. - -The documentation provided for packngo fields and functions should be at or -better than the quality provided at . -When the API documentation provides a lengthy description, a linking to the -related API documentation will benefit users. - -### Linters - -`golangci-lint` is used to verify that the style of the code remains consistent. - -Before committing, it's a good idea to run `goimports -w .`. -([goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports?tab=doc)) and -`gofmt -w *.go`. ([gofmt](https://golang.org/cmd/gofmt/)) - -`make lint` can be used to verify style before creating a pull request. - -## Building and Testing - -The [Makefile](./Makefile) contains the targets to build, lint and test: - -```sh -make build -make lint -make test -``` - -These normally will be run in a docker image of golang. To run locally, just run -with `BUILD=local`: - -```sh -make build BUILD=local -make lint BUILD=local -make test BUILD=local -``` - -### Acceptance Tests - -If you want to run tests against the actual Equinix Metal API, you must set the -environment variable `PACKET_TEST_ACTUAL_API` to a non-empty string and set -`PACKNGO_TEST_RECORDER` to `disabled`. The device tests wait for the device -creation, so it's best to run a few in parallel. - -To run a particular test, you can do - -```sh -PACKNGO_TEST_ACTUAL_API=1 go test -v -run=TestAccDeviceBasic --timeout=2h -``` - -If you want to see HTTP requests, set the `PACKNGO_DEBUG` env var to non-empty -string, for example: - -```sh -PACKNGO_DEBUG=1 PACKNGO_TEST_ACTUAL_API=1 go test -v -run=TestAccVolumeUpdate -``` - -### Test Fixtures - -By default, `go test ./...` will skip most of the tests unless -`PACKNGO_TEST_ACTUAL_API` is non-empty. - -With the `PACKNGO_TEST_ACTUAL_API` environment variable set, tests will be run -against the Equinix Metal API, creating real infrastructure and incurring costs. - -The `PACKNGO_TEST_RECORDER` variable can be used to record and playback API -responses to test code changes without the delay and costs of making actual API -calls. When unset, `PACKNGO_TEST_RECORDER` acts as though it was set to -`disabled`. This is the default behavior. This default behavior may change in -the future once fixtures are available for all tests. - -When `PACKNGO_TEST_RECORDER` is set to `play`, tests will playback API responses -from recorded HTTP response fixtures. This is idea for refactoring and making -changes to request and response handling without introducing changes to the data -sent or received by the Equinix Metal API. - -When adding support for new end-points, recorded test sessions should be added. -Record the HTTP interactions to fixtures by setting the environment variable -`PACKNGO_TEST_RECORDER` to `record`. - -The fixtures are automatically named according to the test they were run from. -They are placed in `fixtures/`. The API token used during authentication is -automatically removed from these fixtures. Nonetheless, caution should be -exercised before committing any fixtures into the project. Account details -includes API tokens, contact, and payment details could easily be leaked by -committing fixtures that haven't been thoroughly reviewed. - -### Automation (CI/CD) - -Today, Drone tests pull requests using tests defined in -[.drone.yml](.drone.yml). - -See [RELEASE.md](RELEASE.md) for details on the release process. diff --git a/vendor/github.com/packethost/packngo/DCO b/vendor/github.com/packethost/packngo/DCO deleted file mode 100644 index 068953d4..00000000 --- a/vendor/github.com/packethost/packngo/DCO +++ /dev/null @@ -1,37 +0,0 @@ -Developer Certificate of Origin -Version 1.1 - -Copyright (C) 2004, 2006 The Linux Foundation and its contributors. -660 York Street, Suite 102, -San Francisco, CA 94110 USA - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - - -Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -(a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -(b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -(c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -(d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. - diff --git a/vendor/github.com/packethost/packngo/LICENSE.txt b/vendor/github.com/packethost/packngo/LICENSE.txt deleted file mode 100644 index 57c50110..00000000 --- a/vendor/github.com/packethost/packngo/LICENSE.txt +++ /dev/null @@ -1,56 +0,0 @@ -Copyright (c) 2014 The packngo AUTHORS. All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -====================== -Portions of the client are based on code at: -https://github.com/google/go-github/ and -https://github.com/digitalocean/godo - -Copyright (c) 2013 The go-github AUTHORS. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/vendor/github.com/packethost/packngo/Makefile b/vendor/github.com/packethost/packngo/Makefile deleted file mode 100644 index 90ceffa3..00000000 --- a/vendor/github.com/packethost/packngo/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -IMG ?= golang:1.15 - -# enable go modules, disabled CGO - -GOENV ?= GO111MODULE=on CGO_ENABLED=0 -export GO111MODULE=on -export CGO_ENABLED=0 - -# we build in a docker image, unless we are set to BUILD=local -GO ?= docker run --rm -v $(PWD):/app -w /app $(IMG) env $(GOENV) -ifeq ($(BUILD),local) -GO = -endif - - -build: - $(GO) go build -i -v ./... - -lint: - @docker run --rm -v $(CURDIR):/app -w /app golangci/golangci-lint:v1.34.1 golangci-lint run -v - -test: - $(GO) test ./... - diff --git a/vendor/github.com/packethost/packngo/OWNERS.md b/vendor/github.com/packethost/packngo/OWNERS.md deleted file mode 100644 index 8b002e98..00000000 --- a/vendor/github.com/packethost/packngo/OWNERS.md +++ /dev/null @@ -1,26 +0,0 @@ -# Owners - -This project is governed by [Equinix Metal] and benefits from a community of users that -collaborate and contribute to its use in Go powered projects, such as the [Equinix Metal -Terraform provider], [Docker machine driver], Kubernetes drivers for [CSI] and [CCM], -the [Equinix Metal CLI], and others. - -Members of the Equinix Metal Github organization will strive to triage issues in a -timely manner, see [SUPPORT.md] for details. - -See the [packethost/standards glossary] for more details about this file. - -## Maintainers - -Maintainers of this repository are defined within the [CODEOWNERS] file. - -[Equinix Metal]: https://metal.equinix.com -[Equinix Metal Terraform provider]: https://github.com/packethost/terraform-provider-packet -[Docker machine driver]: https://github.com/packethost/docker-machine-driver-packet -[CSI]: https://github.com/packethost/csi-packet -[CCM]: https://github.com/packethost/packet-ccm -[Equinix Metal CLI]: https://github.com/packethost/packet-cli -[SUPPORT.md]: SUPPORT.md -[packethost/standards -glossary]: https://github.com/packethost/standards/blob/master/glossary.md#ownersmd -[CODEOWNERS]: CODEOWNERS diff --git a/vendor/github.com/packethost/packngo/README.md b/vendor/github.com/packethost/packngo/README.md deleted file mode 100644 index 97d37062..00000000 --- a/vendor/github.com/packethost/packngo/README.md +++ /dev/null @@ -1,136 +0,0 @@ -# packngo - -[![](https://img.shields.io/badge/stability-maintained-green.svg)](https://github.com/packethost/standards/blob/master/maintained-statement.md) -[![Release](https://img.shields.io/github/v/release/packethost/packngo)](https://github.com/packethost/packngo/releases/latest) -[![GoDoc](https://godoc.org/github.com/packethost/packngo?status.svg)](https://godoc.org/github.com/packethost/packngo) -[![Go Report Card](https://goreportcard.com/badge/github.com/packethost/packngo)](https://goreportcard.com/report/github.com/packethost/packngo) -[![Slack](https://slack.equinixmetal.com/badge.svg)](https://slack.equinixmetal.com/) -[![Twitter Follow](https://img.shields.io/twitter/follow/equinixmetal.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=equinixmetal) - -A Golang client for the Equinix Metal API. ([Packet is now Equinix Metal](https://blog.equinix.com/blog/2020/10/06/equinix-metal-metal-and-more/)) - -## Installation - -To import this library into your Go project: - -```go -import "github.com/packethost/packngo" -``` - -Reference a particular version with: - -```sh -go get github.com/packethost/packngo@v0.2.0 -``` - -## Stability and Compatibility - -This repository is [Maintained](https://github.com/packethost/standards/blob/master/maintained-statement.md) meaning that this software is supported by Equinix Metal and its community - available to use in production environments. - -Packngo is currently provided with a major version of [v0](https://blog.golang.org/v2-go-modules). We'll try to avoid breaking changes to this library, but they will certainly happen as we work towards a stable v1 library. See [CHANGELOG.md](CHANGELOG.md) for details on the latest additions, removals, fixes, and breaking changes. - -While packngo provides an interface to most of the [Equinix Metal API](https://metal.equinix.com/developers/api/), the API is regularly adding new features. To request or contribute support for more API end-points or added fields, [create an issue](https://github.com/packethost/packngo/issues/new). - -See [SUPPORT.md](SUPPORT.md) for any other issues. - -## Usage - -To authenticate to the Equinix Metal API, you must have your API token exported in env var `PACKET_AUTH_TOKEN`. - -This code snippet initializes Equinix Metal API client, and lists your Projects: - -```go -package main - -import ( - "log" - - "github.com/packethost/packngo" -) - -func main() { - c, err := packngo.NewClient() - if err != nil { - log.Fatal(err) - } - - ps, _, err := c.Projects.List(nil) - if err != nil { - log.Fatal(err) - } - for _, p := range ps { - log.Println(p.ID, p.Name) - } -} - -``` - -This library is used by the official [terraform-provider-packet](https://github.com/packethost/terraform-provider-packet). - -You can also learn a lot from the `*_test.go` sources. Almost all out tests touch the Equinix Metal API, so you can see how auth, querying and POSTing works. For example [devices_test.go](devices_test.go). - -
-Linked Resources - -### Linked resources in Get\* and List\* functions - -The Equinix Metal API includes references to related entities for a wide selection of resource types, indicated by `href` fields. The Equinix Metal API allows for these entities to be included in the API response, saving the user from making more round-trip API requests. This is useful for linked resources, e.g members of a project, devices in a project. Similarly, by excluding entities that are included by default, you can reduce the API response time and payload size. - -Control of this behavior is provided through [common attributes](https://metal.equinix.com/developers/api/common-parameters/) that can be used to toggle, by field name, which referenced resources will be included as values in API responses. The API exposes this feature through `?include=` and `?exclude=` query parameters which accept a comma-separated list of field names. These field names can be dotted to reference nested entities. - -Most of the packngo `Get` functions take references to `GetOptions` parameters (or `ListOptions` for `List` functions). These types include an `Include` and `Exclude` slice that will be converted to query parameters upon request. - -For example, if you want to list users in a project, you can fetch the project via `Projects.Get(pid, nil)` call. The result of this call will be a `Project` which has a `Users []User` attribute. The items in the `[]User` slice only have a non-zero URL attribute, the rest of the fields will be type defaults. You can then parse the ID of the User resources and fetch them consequently. - -Optionally, you can use the ListOptions struct in the project fetch call to include the Users (`members` JSON tag). Then, every item in the `[]User` slice will have all (not only the `Href`) attributes populated. - -```go -Projects.Get(pid, &packngo.ListOptions{Includes: []{'members'}}) -``` - -The following is a more comprehensive illustration of Includes and Excludes. - -```go -import ( - "log" - - "github.com/packethost/packngo" -) - -func listProjectsAndUsers(lo *packngo.ListOptions) { - c, err := packngo.NewClient() - if err != nil { - log.Fatal(err) - } - - ps, _, err := c.Projects.List(lo) - if err != nil { - log.Fatal(err) - } - log.Printf("Listing for listOptions %+v\n", lo) - for _, p := range ps { - log.Printf("project resource %s has %d users", p.Name, len(p.Users)) - for _, u := range p.Users { - if u.Email != "" && u.FullName != "" { - log.Printf(" user %s has email %s\n", u.FullName, u.Email) - } else { - log.Printf(" only got user link %s\n", u.URL) - } - } - } -} - -func main() { - loMembers := &packngo.ListOptions{Includes: []string{"members"}} - loMembersOut := &packngo.ListOptions{Excludes: []string{"members"}} - listProjectsAndUsers(loMembers) - listProjectsAndUsers(nil) - listProjectsAndUsers(loMembersOut) -} -``` - -
- -## Contributing - -See [CONTIBUTING.md](CONTRIBUTING.md). diff --git a/vendor/github.com/packethost/packngo/RELEASE.md b/vendor/github.com/packethost/packngo/RELEASE.md deleted file mode 100644 index a4dcd3c0..00000000 --- a/vendor/github.com/packethost/packngo/RELEASE.md +++ /dev/null @@ -1,49 +0,0 @@ -# Releases - -This file serves to provide guidance and act as a checklist for any maintainers -to this project, now or in the future. This file should be updated with any -changes to the process. Automated processes should be described well enough that -they can be run in the absence of that automation. - -* See [CHANGELOG.md](CHANGELOG.md) for notes on versioning. -* Fetch the latest origin branches: - - ```sh - git fetch origin - git checkout master - git pull - ``` - -* Verify that your branch matches the upstream branch: - - ```sh - git branch --points-at=master -r | grep origin/master >/dev/null || echo "master differs from origin/master" - ``` - -* Update the `Version` variable. This is a library, so we can not assure - that a build flag will be used in every client that provides a compile time - value, let alone the correct one. - - ```sh - vim version.go # change Version, "0.8.0" (no v) - git commit --signoff -m 'v0.8.0 version bump' packngo.go - ``` - -* Tag `master` with a semver tag that suits the level of changes - introduced: - - ```sh - git tag -m "v0.8.0" -a v0.8.0 master # use -s if gpg is available - ``` -* Push the tag: - - ```sh - git push --tags origin master v0.8.0 - ``` -* Create a release from the tag (include a keepthechangelog.com formatted description): - - (use the correct - version) - -Releases can be followed through the GitHub Atom feed at -. diff --git a/vendor/github.com/packethost/packngo/SUPPORT.md b/vendor/github.com/packethost/packngo/SUPPORT.md deleted file mode 100644 index 86f8401f..00000000 --- a/vendor/github.com/packethost/packngo/SUPPORT.md +++ /dev/null @@ -1,17 +0,0 @@ -# Support - -Please [open a GitHub Issue] stating any problems that you encounter using this -software. Be sure to leave a descriptive report of the problem, including the -environment you were running in and the expected behavior. Be careful not to -include any sensitive information such as API Keys, IP addresses or their -ranges, or any resource identifiers (UUID or ID) of your organizations, -projects, or devices. - -As an open-source project, the priority, timing, or eventual resolution is not -guaranteed. Issues will be addressed based on priorities that may or may not -be reflected in Github or issue comments. - -For other forms of support, including our Slack community, visit -. - -[open a GitHub Issue]: https://github.com/packethost/packngo/issues/new \ No newline at end of file diff --git a/vendor/github.com/packethost/packngo/api_call_options.go b/vendor/github.com/packethost/packngo/api_call_options.go deleted file mode 100644 index a1aa627a..00000000 --- a/vendor/github.com/packethost/packngo/api_call_options.go +++ /dev/null @@ -1,180 +0,0 @@ -package packngo - -import ( - "fmt" - "net/url" - "strconv" - "strings" -) - -type ListSortDirection string - -const ( - SortDirectionAsc ListSortDirection = "asc" - SortDirectionDesc ListSortDirection = "desc" -) - -// GetOptions are options common to Equinix Metal API GET requests -type GetOptions struct { - // Includes are a list of fields to expand in the request results. - // - // For resources that contain collections of other resources, the Equinix Metal API - // will only return the `Href` value of these resources by default. In - // nested API Go types, this will result in objects that have zero values in - // all fiends except their `Href` field. When an object's associated field - // name is "included", the returned fields will be Uumarshalled into the - // nested object. Field specifiers can use a dotted notation up to three - // references deep. (For example, "memberships.projects" can be used in - // ListUsers.) - Includes []string `url:"include,omitempty,comma"` - - // Excludes reduce the size of the API response by removing nested objects - // that may be returned. - // - // The default behavior of the Equinix Metal API is to "exclude" fields, but some - // API endpoints have an "include" behavior on certain fields. Nested Go - // types unmarshalled into an "excluded" field will only have a values in - // their `Href` field. - Excludes []string `url:"exclude,omitempty,comma"` - - // Page is the page of results to retrieve for paginated result sets - Page int `url:"page,omitempty"` - - // PerPage is the number of results to return per page for paginated result - // sets, - PerPage int `url:"per_page,omitempty"` - - // Search is a special API query parameter that, for resources that support - // it, will filter results to those with any one of various fields matching - // the supplied keyword. For example, a resource may have a defined search - // behavior matches either a name or a fingerprint field, while another - // resource may match entirely different fields. Search is currently - // implemented for SSHKeys and uses an exact match. - Search string `url:"search,omitempty"` - - SortBy string `url:"sort_by,omitempty"` - SortDirection ListSortDirection `url:"sort_direction,omitempty"` - - Meta meta `url:"-"` -} - -type ListOptions = GetOptions -type SearchOptions = GetOptions - -type QueryAppender interface { - WithQuery(path string) string // we use this in all List functions (urlQuery) - GetPage() int // we use this in List - Including(...string) // we use this in Device List to add facility -} - -// GetOptions returns GetOptions from GetOptions (and is nil-receiver safe) -func (g *GetOptions) GetOptions() *GetOptions { - getOpts := GetOptions{} - if g != nil { - getOpts.Includes = g.Includes - getOpts.Excludes = g.Excludes - } - return &getOpts -} - -func (g *GetOptions) WithQuery(apiPath string) string { - params := g.Encode() - if params != "" { - // parse path, take existing vars - return fmt.Sprintf("%s?%s", apiPath, params) - } - return apiPath -} - -// OptionsGetter provides GetOptions -type OptionsGetter interface { - GetOptions() *GetOptions -} - -func (g *GetOptions) GetPage() int { // guaranteed int - if g == nil { - return 0 - } - return g.Page -} - -func (g *GetOptions) CopyOrNew() *GetOptions { - if g == nil { - return &GetOptions{} - } - ret := *g - return &ret -} - -// Including ensures that the variadic refs are included in a copy of the -// options, resulting in expansion of the the referred sub-resources. Unknown -// values within refs will be silently ignore by the API. -func (g *GetOptions) Including(refs ...string) *GetOptions { - ret := g.CopyOrNew() - for _, v := range refs { - if !contains(ret.Includes, v) { - ret.Includes = append(ret.Includes, v) - } - } - return ret -} - -func stripQuery(inURL string) string { - u, _ := url.Parse(inURL) - u.RawQuery = "" - return u.String() -} - -// nextPage is common and extracted from all List functions -func nextPage(meta meta, opts *GetOptions) (path string) { - if meta.Next != nil && (opts.GetPage() == 0) { - optsCopy := opts.CopyOrNew() - optsCopy.Page = meta.CurrentPageNum + 1 - return optsCopy.WithQuery(stripQuery(meta.Next.Href)) - } - if opts != nil { - opts.Meta = meta - } - return "" -} - -// Encode generates a URL query string ("?foo=bar") -func (g *GetOptions) Encode() string { - if g == nil { - return "" - } - v := url.Values{} - if g.Includes != nil && len(g.Includes) > 0 { - v.Add("include", strings.Join(g.Includes, ",")) - } - if g.Excludes != nil && len(g.Excludes) > 0 { - v.Add("exclude", strings.Join(g.Excludes, ",")) - } - if g.Page != 0 { - v.Add("page", strconv.Itoa(g.Page)) - } - if g.PerPage != 0 { - v.Add("per_page", strconv.Itoa(g.PerPage)) - } - if g.Search != "" { - v.Add("search", g.Search) - } - if g.SortBy != "" { - v.Add("sort_by", g.SortBy) - } - if g.SortDirection != "" { - v.Add("sort_direction", string(g.SortDirection)) - } - return v.Encode() -} - -/* -// Encode generates a URL query string ("?foo=bar") -func (g *GetOptions) Encode() string { - urlValues, _ := query.Values(g) - return urlValues.Encode() -} -*/ -func urlQuery(o *GetOptions) string { - return o.Encode() -} diff --git a/vendor/github.com/packethost/packngo/apikeys.go b/vendor/github.com/packethost/packngo/apikeys.go deleted file mode 100644 index 5241fa9c..00000000 --- a/vendor/github.com/packethost/packngo/apikeys.go +++ /dev/null @@ -1,176 +0,0 @@ -package packngo - -import ( - "fmt" - "path" -) - -const ( - apiKeyBasePath = "/api-keys" -) - -// APIKeyService interface defines available device methods -type APIKeyService interface { - UserList(*ListOptions) ([]APIKey, *Response, error) - ProjectList(string, *ListOptions) ([]APIKey, *Response, error) - UserGet(string, *GetOptions) (*APIKey, error) - ProjectGet(string, string, *GetOptions) (*APIKey, error) - Create(*APIKeyCreateRequest) (*APIKey, *Response, error) - Delete(string) (*Response, error) -} - -type apiKeyRoot struct { - APIKeys []APIKey `json:"api_keys"` -} - -type APIKey struct { - // ID is the UUIDv4 representing an API key in API requests and responses. - ID string `json:"id"` - - // Description is any text description of the key. This can be used to - // describe the purpose of the key. - Description string `json:"description"` - - // Token is a sensitive credential that can be used as a `Client.APIKey` to - // access Equinix Metal resources. - Token string `json:"token"` - - // ReadOnly keys can not create new resources. - ReadOnly bool `json:"read_only"` - - // Created is the creation date of the API key. - Created string `json:"created_at"` - - // Updated is the last-update date of the API key. - Updated string `json:"updated_at"` - - // User will be non-nil when getting or listing an User API key. - User *User `json:"user"` - - // Project will be non-nil when getting or listing a Project API key - Project *Project `json:"project"` -} - -// APIKeyCreateRequest type used to create an api key. -type APIKeyCreateRequest struct { - // Description is any text description of the key. This can be used to - // describe the purpose of the key. - Description string `json:"description"` - - // ReadOnly keys can not create new resources. - ReadOnly bool `json:"read_only"` - - // ProjectID when non-empty will result in the creation of a Project API - // key. - ProjectID string `json:"-"` -} - -func (s APIKeyCreateRequest) String() string { - return Stringify(s) -} - -// APIKeyServiceOp implements APIKeyService -type APIKeyServiceOp struct { - client *Client -} - -func (s *APIKeyServiceOp) list(url string, opts *ListOptions) ([]APIKey, *Response, error) { - root := new(apiKeyRoot) - apiPathQuery := opts.WithQuery(url) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, root) - if err != nil { - return nil, resp, err - } - - return root.APIKeys, resp, err -} - -// ProjectList lists the API keys associated with a project having `projectID` -// match `Project.ID`. -func (s *APIKeyServiceOp) ProjectList(projectID string, opts *ListOptions) ([]APIKey, *Response, error) { - endpointPath := path.Join(projectBasePath, projectID, apiKeyBasePath) - return s.list(endpointPath, opts) -} - -// UserList returns the API keys for the User associated with the -// `Client.APIKey`. -// -// When `Client.APIKey` is a Project API key, this method will return an access -// denied error. -func (s *APIKeyServiceOp) UserList(opts *ListOptions) ([]APIKey, *Response, error) { - endpointPath := path.Join(userBasePath, apiKeyBasePath) - return s.list(endpointPath, opts) -} - -// ProjectGet returns the Project API key with the given `APIKey.ID`. -// -// In other methods, it is typical for a Response to be returned, which could -// include a StatusCode of `http.StatusNotFound` (404 error) when the resource -// was not found. The Equinix Metal API does not expose a get by ID endpoint for -// APIKeys. That is why in this method, all API keys are listed and compared -// for a match. Therefor, the Response is not returned and a custom error will -// be returned when the key is not found. -func (s *APIKeyServiceOp) ProjectGet(projectID, apiKeyID string, opts *GetOptions) (*APIKey, error) { - pkeys, _, err := s.ProjectList(projectID, opts) - if err != nil { - return nil, err - } - for _, k := range pkeys { - if k.ID == apiKeyID { - return &k, nil - } - } - return nil, fmt.Errorf("Project (%s) API key %s not found", projectID, apiKeyID) -} - -// UserGet returns the User API key with the given `APIKey.ID`. -// -// In other methods, it is typical for a Response to be returned, which could -// include a StatusCode of `http.StatusNotFound` (404 error) when the resource -// was not found. The Equinix Metal API does not expose a get by ID endpoint for -// APIKeys. That is why in this method, all API keys are listed and compared -// for a match. Therefor, the Response is not returned and a custom error will -// be returned when the key is not found. -func (s *APIKeyServiceOp) UserGet(apiKeyID string, opts *GetOptions) (*APIKey, error) { - ukeys, _, err := s.UserList(opts) - if err != nil { - return nil, err - } - for _, k := range ukeys { - if k.ID == apiKeyID { - return &k, nil - } - } - return nil, fmt.Errorf("User API key %s not found", apiKeyID) -} - -// Create creates a new API key. -// -// The API key can be either an User API key or a Project API key, determined by -// the value (or emptiness) of `APIKeyCreateRequest.ProjectID`. Either `User` or -// `Project` will be non-nil in the `APIKey` depending on this factor. -func (s *APIKeyServiceOp) Create(createRequest *APIKeyCreateRequest) (*APIKey, *Response, error) { - apiPath := path.Join(userBasePath, apiKeyBasePath) - if createRequest.ProjectID != "" { - apiPath = path.Join(projectBasePath, createRequest.ProjectID, apiKeyBasePath) - } - apiKey := new(APIKey) - - resp, err := s.client.DoRequest("POST", apiPath, createRequest, apiKey) - if err != nil { - return nil, resp, err - } - - return apiKey, resp, err -} - -// Delete deletes an API key by `APIKey.ID` -// -// The API key can be either an User API key or a Project API key. -// -// Project API keys can not be used to delete themselves. -func (s *APIKeyServiceOp) Delete(apiKeyID string) (*Response, error) { - apiPath := path.Join(userBasePath, apiKeyBasePath, apiKeyID) - return s.client.DoRequest("DELETE", apiPath, nil, nil) -} diff --git a/vendor/github.com/packethost/packngo/batches.go b/vendor/github.com/packethost/packngo/batches.go deleted file mode 100644 index 3afb0521..00000000 --- a/vendor/github.com/packethost/packngo/batches.go +++ /dev/null @@ -1,101 +0,0 @@ -package packngo - -import ( - "fmt" - "path" -) - -const batchBasePath = "/batches" - -// BatchService interface defines available batch methods -type BatchService interface { - Get(batchID string, getOpt *GetOptions) (*Batch, *Response, error) - List(ProjectID string, listOpt *ListOptions) ([]Batch, *Response, error) - Create(projectID string, batches *BatchCreateRequest) ([]Batch, *Response, error) - Delete(string, bool) (*Response, error) -} - -// Batch type -type Batch struct { - ID string `json:"id"` - State string `json:"state,omitempty"` - Quantity int32 `json:"quantity,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - Href string `json:"href,omitempty"` - Project Href `json:"project,omitempty"` - Devices []Device `json:"devices,omitempty"` -} - -//BatchesList represents collection of batches -type batchesList struct { - Batches []Batch `json:"batches,omitempty"` -} - -// BatchCreateRequest type used to create batch of device instances -type BatchCreateRequest struct { - Batches []BatchCreateDevice `json:"batches"` -} - -// BatchCreateDevice type used to describe batch instances -type BatchCreateDevice struct { - DeviceCreateRequest - Quantity int32 `json:"quantity"` - FacilityDiversityLevel int32 `json:"facility_diversity_level,omitempty"` -} - -// BatchServiceOp implements BatchService -type BatchServiceOp struct { - client *Client -} - -// Get returns batch details -func (s *BatchServiceOp) Get(batchID string, opts *GetOptions) (*Batch, *Response, error) { - endpointPath := path.Join(batchBasePath, batchID) - apiPathQuery := opts.WithQuery(endpointPath) - batch := new(Batch) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, batch) - if err != nil { - return nil, resp, err - } - - return batch, resp, err -} - -// List returns batches on a project -func (s *BatchServiceOp) List(projectID string, opts *ListOptions) (batches []Batch, resp *Response, err error) { - endpointPath := path.Join(projectBasePath, projectID, batchBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - subset := new(batchesList) - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - batches = append(batches, subset.Batches...) - return batches, resp, err -} - -// Create function to create batch of device instances -func (s *BatchServiceOp) Create(projectID string, request *BatchCreateRequest) ([]Batch, *Response, error) { - apiPath := path.Join(projectBasePath, projectID, "devices", "batch") - - batches := new(batchesList) - resp, err := s.client.DoRequest("POST", apiPath, request, batches) - - if err != nil { - return nil, resp, err - } - - return batches.Batches, resp, err -} - -// Delete function to remove an instance batch -func (s *BatchServiceOp) Delete(id string, removeDevices bool) (*Response, error) { - // API doc days the remove_associated_instances params shout be in the body - // https://metal.equinix.com/developers/api/batches/#delete-the-batch - // .. does this even work? - apiPath := fmt.Sprintf("%s/%s?remove_associated_instances=%t", batchBasePath, id, removeDevices) - - return s.client.DoRequest("DELETE", apiPath, nil, nil) -} diff --git a/vendor/github.com/packethost/packngo/bgp_configs.go b/vendor/github.com/packethost/packngo/bgp_configs.go deleted file mode 100644 index 95dc5b07..00000000 --- a/vendor/github.com/packethost/packngo/bgp_configs.go +++ /dev/null @@ -1,85 +0,0 @@ -package packngo - -import ( - "path" -) - -var ( - bgpConfigPostBasePath = "/bgp-configs" - bgpConfigGetBasePath = "/bgp-config" -) - -// BGPConfigService interface defines available BGP config methods -type BGPConfigService interface { - Get(projectID string, getOpt *GetOptions) (*BGPConfig, *Response, error) - Create(projectID string, request CreateBGPConfigRequest) (*Response, error) - // Delete(configID string) (resp *Response, err error) TODO: Not in Equinix Metal API -} - -// BGPConfigServiceOp implements BgpConfigService -type BGPConfigServiceOp struct { - client *Client -} - -// CreateBGPConfigRequest struct -type CreateBGPConfigRequest struct { - DeploymentType string `json:"deployment_type,omitempty"` - Asn int `json:"asn,omitempty"` - Md5 string `json:"md5,omitempty"` - UseCase string `json:"use_case,omitempty"` -} - -// BGPConfig represents an Equinix Metal BGP Config -type BGPConfig struct { - ID string `json:"id,omitempty"` - Status string `json:"status,omitempty"` - DeploymentType string `json:"deployment_type,omitempty"` - Asn int `json:"asn,omitempty"` - RouteObject string `json:"route_object,omitempty"` - Md5 string `json:"md5,omitempty"` - MaxPrefix int `json:"max_prefix,omitempty"` - Project Project `json:"project,omitempty"` - CreatedAt Timestamp `json:"created_at,omitempty"` - RequestedAt Timestamp `json:"requested_at,omitempty"` - Sessions []BGPSession `json:"sessions,omitempty"` - Href string `json:"href,omitempty"` -} - -// Create function -func (s *BGPConfigServiceOp) Create(projectID string, request CreateBGPConfigRequest) (*Response, error) { - apiPath := path.Join(projectBasePath, projectID, bgpConfigPostBasePath) - - resp, err := s.client.DoRequest("POST", apiPath, request, nil) - if err != nil { - return resp, err - } - - return resp, err -} - -// Get function -func (s *BGPConfigServiceOp) Get(projectID string, opts *GetOptions) (bgpConfig *BGPConfig, resp *Response, err error) { - endpointPath := path.Join(projectBasePath, projectID, bgpConfigGetBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - - subset := new(BGPConfig) - - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - return subset, resp, err -} - -// Delete function TODO: this is not implemented in the Equinix Metal API -// func (s *BGPConfigServiceOp) Delete(configID string) (resp *Response, err error) { -// apiPath := fmt.Sprintf("%ss/%s", bgpConfigBasePath, configID) - -// resp, err = s.client.DoRequest("DELETE", apiPath, nil, nil) -// if err != nil { -// return resp, err -// } - -// return resp, err -// } diff --git a/vendor/github.com/packethost/packngo/bgp_sessions.go b/vendor/github.com/packethost/packngo/bgp_sessions.go deleted file mode 100644 index 0054a51e..00000000 --- a/vendor/github.com/packethost/packngo/bgp_sessions.go +++ /dev/null @@ -1,99 +0,0 @@ -package packngo - -import ( - "path" -) - -var bgpSessionBasePath = "/bgp/sessions" -var bgpNeighborsBasePath = "/bgp/neighbors" - -// BGPSessionService interface defines available BGP session methods -type BGPSessionService interface { - Get(string, *GetOptions) (*BGPSession, *Response, error) - Create(string, CreateBGPSessionRequest) (*BGPSession, *Response, error) - Delete(string) (*Response, error) -} - -type bgpSessionsRoot struct { - Sessions []BGPSession `json:"bgp_sessions"` - Meta meta `json:"meta"` -} - -// BGPSessionServiceOp implements BgpSessionService -type BGPSessionServiceOp struct { - client *Client -} - -// BGPSession represents an Equinix Metal BGP Session -type BGPSession struct { - ID string `json:"id,omitempty"` - Status string `json:"status,omitempty"` - LearnedRoutes []string `json:"learned_routes,omitempty"` - AddressFamily string `json:"address_family,omitempty"` - Device Device `json:"device,omitempty"` - Href string `json:"href,omitempty"` - DefaultRoute *bool `json:"default_route,omitempty"` -} - -type bgpNeighborsRoot struct { - BGPNeighbors []BGPNeighbor `json:"bgp_neighbors"` -} - -// BGPNeighor is struct for listing BGP neighbors of a device -type BGPNeighbor struct { - AddressFamily int `json:"address_family"` - CustomerAs int `json:"customer_as"` - CustomerIP string `json:"customer_ip"` - Md5Enabled bool `json:"md5_enabled"` - Md5Password string `json:"md5_password"` - Multihop bool `json:"multihop"` - PeerAs int `json:"peer_as"` - PeerIps []string `json:"peer_ips"` - RoutesIn []BGPRoute `json:"routes_in"` - RoutesOut []BGPRoute `json:"routes_out"` -} - -// BGPRoute is a struct for Route in BGP neighbor listing -type BGPRoute struct { - Route string `json:"route"` - Exact bool `json:"exact"` -} - -// CreateBGPSessionRequest struct -type CreateBGPSessionRequest struct { - AddressFamily string `json:"address_family"` - DefaultRoute *bool `json:"default_route,omitempty"` -} - -// Create function -func (s *BGPSessionServiceOp) Create(deviceID string, request CreateBGPSessionRequest) (*BGPSession, *Response, error) { - apiPath := path.Join(deviceBasePath, deviceID, bgpSessionBasePath) - session := new(BGPSession) - - resp, err := s.client.DoRequest("POST", apiPath, request, session) - if err != nil { - return nil, resp, err - } - - return session, resp, err -} - -// Delete function -func (s *BGPSessionServiceOp) Delete(id string) (*Response, error) { - apiPath := path.Join(bgpSessionBasePath, id) - - return s.client.DoRequest("DELETE", apiPath, nil, nil) -} - -// Get function -func (s *BGPSessionServiceOp) Get(id string, opts *GetOptions) (session *BGPSession, response *Response, err error) { - endpointPath := path.Join(bgpSessionBasePath, id) - apiPathQuery := opts.WithQuery(endpointPath) - session = new(BGPSession) - response, err = s.client.DoRequest("GET", apiPathQuery, nil, session) - if err != nil { - return nil, response, err - } - - return session, response, err -} diff --git a/vendor/github.com/packethost/packngo/billing_address.go b/vendor/github.com/packethost/packngo/billing_address.go deleted file mode 100644 index 93255b32..00000000 --- a/vendor/github.com/packethost/packngo/billing_address.go +++ /dev/null @@ -1,7 +0,0 @@ -package packngo - -type BillingAddress struct { - StreetAddress string `json:"street_address,omitempty"` - PostalCode string `json:"postal_code,omitempty"` - CountryCode string `json:"country_code_alpha2,omitempty"` -} diff --git a/vendor/github.com/packethost/packngo/capacities.go b/vendor/github.com/packethost/packngo/capacities.go deleted file mode 100644 index 45ffac60..00000000 --- a/vendor/github.com/packethost/packngo/capacities.go +++ /dev/null @@ -1,103 +0,0 @@ -package packngo - -const ( - capacityBasePath = "/capacity" - capacityBasePathMetros = "/capacity/metros" -) - -// CapacityService interface defines available capacity methods -type CapacityService interface { - List() (*CapacityReport, *Response, error) - ListMetros() (*CapacityReport, *Response, error) - Check(*CapacityInput) (*CapacityInput, *Response, error) - CheckMetros(*CapacityInput) (*CapacityInput, *Response, error) -} - -// CapacityInput struct -type CapacityInput struct { - Servers []ServerInfo `json:"servers,omitempty"` -} - -// ServerInfo struct -type ServerInfo struct { - Facility string `json:"facility,omitempty"` - Metro string `json:"metro,omitempty"` - Plan string `json:"plan,omitempty"` - Quantity int `json:"quantity,omitempty"` - Available bool `json:"available,omitempty"` -} - -type capacityRoot struct { - Capacity CapacityReport `json:"capacity,omitempty"` -} - -// CapacityReport map -type CapacityReport map[string]map[string]CapacityPerBaremetal - -// // CapacityPerFacility struct -// type CapacityPerFacility struct { -// T1SmallX86 *CapacityPerBaremetal `json:"t1.small.x86,omitempty"` -// C1SmallX86 *CapacityPerBaremetal `json:"c1.small.x86,omitempty"` -// M1XlargeX86 *CapacityPerBaremetal `json:"m1.xlarge.x86,omitempty"` -// C1XlargeX86 *CapacityPerBaremetal `json:"c1.xlarge.x86,omitempty"` - -// Baremetal0 *CapacityPerBaremetal `json:"baremetal_0,omitempty"` -// Baremetal1 *CapacityPerBaremetal `json:"baremetal_1,omitempty"` -// Baremetal1e *CapacityPerBaremetal `json:"baremetal_1e,omitempty"` -// Baremetal2 *CapacityPerBaremetal `json:"baremetal_2,omitempty"` -// Baremetal2a *CapacityPerBaremetal `json:"baremetal_2a,omitempty"` -// Baremetal2a2 *CapacityPerBaremetal `json:"baremetal_2a2,omitempty"` -// Baremetal3 *CapacityPerBaremetal `json:"baremetal_3,omitempty"` -// } - -// CapacityPerBaremetal struct -type CapacityPerBaremetal struct { - Level string `json:"level,omitempty"` -} - -// CapacityList struct -type CapacityList struct { - Capacity CapacityReport `json:"capacity,omitempty"` -} - -// CapacityServiceOp implements CapacityService -type CapacityServiceOp struct { - client *Client -} - -func capacityList(client *Client, capUrl string) (*CapacityReport, *Response, error) { - root := new(capacityRoot) - - resp, err := client.DoRequest("GET", capUrl, nil, root) - if err != nil { - return nil, resp, err - } - - return &root.Capacity, nil, nil -} - -// List returns a list of facilities and plans with their current capacity. -func (s *CapacityServiceOp) List() (*CapacityReport, *Response, error) { - return capacityList(s.client, capacityBasePath) -} - -// ListMetros returns a list of metros and plans with their current capacity. -func (s *CapacityServiceOp) ListMetros() (*CapacityReport, *Response, error) { - return capacityList(s.client, capacityBasePathMetros) -} - -func checkCapacity(client *Client, input *CapacityInput, capUrl string) (capInput *CapacityInput, resp *Response, err error) { - capInput = new(CapacityInput) - resp, err = client.DoRequest("POST", capUrl, input, capInput) - return capInput, resp, err -} - -// Check validates if a deploy can be fulfilled in a capacity. -func (s *CapacityServiceOp) Check(input *CapacityInput) (capInput *CapacityInput, resp *Response, err error) { - return checkCapacity(s.client, input, capacityBasePath) -} - -// Check validates if a deploy can be fulfilled in a metro. -func (s *CapacityServiceOp) CheckMetros(input *CapacityInput) (capInput *CapacityInput, resp *Response, err error) { - return checkCapacity(s.client, input, capacityBasePathMetros) -} diff --git a/vendor/github.com/packethost/packngo/code-of-conduct.md b/vendor/github.com/packethost/packngo/code-of-conduct.md deleted file mode 100644 index 3a14e528..00000000 --- a/vendor/github.com/packethost/packngo/code-of-conduct.md +++ /dev/null @@ -1,3 +0,0 @@ -# Code Of Conduct - -Please refer to the [Contributor Covenant](https://www.contributor-covenant.org/version/1/2/0/code-of-conduct/). diff --git a/vendor/github.com/packethost/packngo/connections.go b/vendor/github.com/packethost/packngo/connections.go deleted file mode 100644 index e489d845..00000000 --- a/vendor/github.com/packethost/packngo/connections.go +++ /dev/null @@ -1,218 +0,0 @@ -package packngo - -import ( - "path" -) - -type ConnectionRedundancy string -type ConnectionType string -type ConnectionPortRole string - -const ( - connectionBasePath = "/connections" - ConnectionShared ConnectionType = "shared" - ConnectionDedicated ConnectionType = "dedicated" - ConnectionRedundant ConnectionRedundancy = "redundant" - ConnectionPrimary ConnectionRedundancy = "primary" - ConnectionPortPrimary ConnectionPortRole = "primary" - ConnectionPortSecondary ConnectionPortRole = "secondary" -) - -type ConnectionService interface { - OrganizationCreate(string, *ConnectionCreateRequest) (*Connection, *Response, error) - ProjectCreate(string, *ConnectionCreateRequest) (*Connection, *Response, error) - OrganizationList(string, *GetOptions) ([]Connection, *Response, error) - ProjectList(string, *GetOptions) ([]Connection, *Response, error) - Delete(string) (*Response, error) - Get(string, *GetOptions) (*Connection, *Response, error) - Events(string, *GetOptions) ([]Event, *Response, error) - PortEvents(string, string, *GetOptions) ([]Event, *Response, error) - Ports(string, *GetOptions) ([]ConnectionPort, *Response, error) - Port(string, string, *GetOptions) (*ConnectionPort, *Response, error) - VirtualCircuits(string, string, *GetOptions) ([]VirtualCircuit, *Response, error) -} - -type ConnectionServiceOp struct { - client *Client -} - -type connectionPortsRoot struct { - Ports []ConnectionPort `json:"ports"` -} - -type connectionsRoot struct { - Connections []Connection `json:"interconnections"` - Meta meta `json:"meta"` -} - -type ConnectionPort struct { - ID string `json:"id"` - Name string `json:"name,omitempty"` - Status string `json:"status,omitempty"` - Role ConnectionPortRole `json:"role,omitempty"` - Speed int `json:"speed,omitempty"` - Organization *Organization `json:"organization,omitempty"` - VirtualCircuits []VirtualCircuit `json:"virtual_circuits,omitempty"` - LinkStatus string `json:"link_status,omitempty"` - Href string `json:"href,omitempty"` -} - -type Connection struct { - ID string `json:"id"` - Name string `json:"name,omitempty"` - Status string `json:"status,omitempty"` - Redundancy ConnectionRedundancy `json:"redundancy,omitempty"` - Facility *Facility `json:"facility,omitempty"` - Metro *Metro `json:"metro,omitempty"` - Type ConnectionType `json:"type,omitempty"` - Description string `json:"description,omitempty"` - Project *Project `json:"project,omitempty"` - Organization *Organization `json:"organization,omitempty"` - Speed int `json:"speed,omitempty"` - Token string `json:"token,omitempty"` - Tags []string `json:"tags,omitempty"` - Ports []ConnectionPort `json:"ports,omitempty"` -} - -type ConnectionCreateRequest struct { - Name string `json:"name,omitempty"` - Redundancy ConnectionRedundancy `json:"redundancy,omitempty"` - Facility string `json:"facility,omitempty"` - Metro string `json:"metro,omitempty"` - Type ConnectionType `json:"type,omitempty"` - Description *string `json:"description,omitempty"` - Project string `json:"project,omitempty"` - Speed int `json:"speed,omitempty"` - Tags []string `json:"tags,omitempty"` -} - -func (c *Connection) PortByRole(r ConnectionPortRole) *ConnectionPort { - for _, p := range c.Ports { - if p.Role == r { - return &p - } - } - return nil -} - -func (s *ConnectionServiceOp) create(apiUrl string, createRequest *ConnectionCreateRequest) (*Connection, *Response, error) { - connection := new(Connection) - resp, err := s.client.DoRequest("POST", apiUrl, createRequest, connection) - if err != nil { - return nil, resp, err - } - - return connection, resp, err -} - -func (s *ConnectionServiceOp) OrganizationCreate(id string, createRequest *ConnectionCreateRequest) (*Connection, *Response, error) { - apiUrl := path.Join(organizationBasePath, id, connectionBasePath) - return s.create(apiUrl, createRequest) -} - -func (s *ConnectionServiceOp) ProjectCreate(id string, createRequest *ConnectionCreateRequest) (*Connection, *Response, error) { - apiUrl := path.Join(projectBasePath, id, connectionBasePath) - return s.create(apiUrl, createRequest) -} - -func (s *ConnectionServiceOp) list(url string, opts *GetOptions) (connections []Connection, resp *Response, err error) { - apiPathQuery := opts.WithQuery(url) - - for { - subset := new(connectionsRoot) - - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - connections = append(connections, subset.Connections...) - - if apiPathQuery = nextPage(subset.Meta, opts); apiPathQuery != "" { - continue - } - - return - } - -} - -func (s *ConnectionServiceOp) OrganizationList(id string, opts *GetOptions) ([]Connection, *Response, error) { - apiUrl := path.Join(organizationBasePath, id, connectionBasePath) - return s.list(apiUrl, opts) -} - -func (s *ConnectionServiceOp) ProjectList(id string, opts *GetOptions) ([]Connection, *Response, error) { - apiUrl := path.Join(projectBasePath, id, connectionBasePath) - return s.list(apiUrl, opts) -} - -func (s *ConnectionServiceOp) Delete(id string) (*Response, error) { - apiPath := path.Join(connectionBasePath, id) - return s.client.DoRequest("DELETE", apiPath, nil, nil) -} - -func (s *ConnectionServiceOp) Port(connID, portID string, opts *GetOptions) (*ConnectionPort, *Response, error) { - endpointPath := path.Join(connectionBasePath, connID, portBasePath, portID) - apiPathQuery := opts.WithQuery(endpointPath) - port := new(ConnectionPort) - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, port) - if err != nil { - return nil, resp, err - } - return port, resp, err -} - -func (s *ConnectionServiceOp) Get(id string, opts *GetOptions) (*Connection, *Response, error) { - endpointPath := path.Join(connectionBasePath, id) - apiPathQuery := opts.WithQuery(endpointPath) - connection := new(Connection) - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, connection) - if err != nil { - return nil, resp, err - } - return connection, resp, err -} - -func (s *ConnectionServiceOp) Ports(connID string, opts *GetOptions) ([]ConnectionPort, *Response, error) { - endpointPath := path.Join(connectionBasePath, connID, portBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - ports := new(connectionPortsRoot) - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, ports) - if err != nil { - return nil, resp, err - } - return ports.Ports, resp, nil - -} - -func (s *ConnectionServiceOp) Events(id string, opts *GetOptions) ([]Event, *Response, error) { - apiPath := path.Join(connectionBasePath, id, eventBasePath) - return listEvents(s.client, apiPath, opts) -} - -func (s *ConnectionServiceOp) PortEvents(connID, portID string, opts *GetOptions) ([]Event, *Response, error) { - apiPath := path.Join(connectionBasePath, connID, portBasePath, portID, eventBasePath) - return listEvents(s.client, apiPath, opts) -} - -func (s *ConnectionServiceOp) VirtualCircuits(connID, portID string, opts *GetOptions) (vcs []VirtualCircuit, resp *Response, err error) { - endpointPath := path.Join(connectionBasePath, connID, portBasePath, portID, virtualCircuitBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - for { - subset := new(virtualCircuitsRoot) - - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - vcs = append(vcs, subset.VirtualCircuits...) - - if apiPathQuery = nextPage(subset.Meta, opts); apiPathQuery != "" { - continue - } - - return - } -} diff --git a/vendor/github.com/packethost/packngo/device_ports.go b/vendor/github.com/packethost/packngo/device_ports.go deleted file mode 100644 index 0b02acfd..00000000 --- a/vendor/github.com/packethost/packngo/device_ports.go +++ /dev/null @@ -1,323 +0,0 @@ -package packngo - -import ( - "fmt" - "strings" -) - -const portBasePath = "/ports" - -// DevicePortService handles operations on a port which belongs to a particular device -// -// Deprecated: use PortService or Device methods -type DevicePortService interface { - Assign(*PortAssignRequest) (*Port, *Response, error) - Unassign(*PortAssignRequest) (*Port, *Response, error) - AssignNative(*PortAssignRequest) (*Port, *Response, error) - UnassignNative(string) (*Port, *Response, error) - Bond(*Port, bool) (*Port, *Response, error) - Disbond(*Port, bool) (*Port, *Response, error) - DeviceToNetworkType(string, string) (*Device, error) - DeviceNetworkType(string) (string, error) - PortToLayerTwo(string, string) (*Port, *Response, error) - PortToLayerThree(string, string) (*Port, *Response, error) - GetPortByName(string, string) (*Port, error) - GetOddEthPorts(*Device) (map[string]*Port, error) - GetAllEthPorts(*Device) (map[string]*Port, error) - ConvertDevice(*Device, string) error -} - -// DevicePortServiceOp implements DevicePortService on the Equinix Metal API -// -// Deprecated: use PortServiceOp or Device methods -type DevicePortServiceOp struct { - client *Client -} - -// GetPortByName returns the matching Port on the specified device -// -// Deprecated: use Device.GetPortByName -func (i *DevicePortServiceOp) GetPortByName(deviceID, name string) (*Port, error) { - device, _, err := i.client.Devices.Get(deviceID, nil) - if err != nil { - return nil, err - } - return device.GetPortByName(name) -} - -// Assign the specified VLAN to the specified Port -// -// Deprecated: use PortServiceOp.Assign -func (i *DevicePortServiceOp) Assign(par *PortAssignRequest) (*Port, *Response, error) { - return i.client.Ports.Assign(par.PortID, par.VirtualNetworkID) -} - -// AssignNative designates the specified VLAN as the native VLAN for the -// specified Port -// -// Deprecated: use PortServiceOp.AssignNative -func (i *DevicePortServiceOp) AssignNative(par *PortAssignRequest) (*Port, *Response, error) { - return i.client.Ports.AssignNative(par.PortID, par.VirtualNetworkID) -} - -// UnassignNative removes the native VLAN from the specified Port -// -// Deprecated: use PortServiceOp.UnassignNative -func (i *DevicePortServiceOp) UnassignNative(portID string) (*Port, *Response, error) { - return i.client.Ports.UnassignNative(portID) -} - -// Unassign removes the specified VLAN from the specified Port -// -// Deprecated: use PortServiceOp.Unassign -func (i *DevicePortServiceOp) Unassign(par *PortAssignRequest) (*Port, *Response, error) { - return i.client.Ports.Unassign(par.PortID, par.VirtualNetworkID) -} - -// Bond enabled bonding on the specified port -// -// Deprecated: use PortServiceOp.Bond -func (i *DevicePortServiceOp) Bond(p *Port, bulk_enable bool) (*Port, *Response, error) { - if p.Data.Bonded { - return p, nil, nil - } - - return i.client.Ports.Bond(p.ID, bulk_enable) -} - -// Disbond disables bonding on the specified port -// -// Deprecated: use PortServiceOp.Disbond -func (i *DevicePortServiceOp) Disbond(p *Port, bulk_disable bool) (*Port, *Response, error) { - if !p.Data.Bonded { - return p, nil, nil - } - return i.client.Ports.Disbond(p.ID, bulk_disable) -} - -// PortToLayerTwo fetches the specified device, finds the matching port by name, -// and converts it to layer2. A port may already be in a layer2 mode, in which -// case the port will be returned with a nil response and nil error with no -// additional action taking place. -// -// Deprecated: use PortServiceOp.ConvertToLayerTwo -func (i *DevicePortServiceOp) PortToLayerTwo(deviceID, portName string) (*Port, *Response, error) { - p, err := i.GetPortByName(deviceID, portName) - if err != nil { - return nil, nil, err - } - if strings.HasPrefix(p.NetworkType, "layer2") { - return p, nil, nil - } - - return i.client.Ports.ConvertToLayerTwo(p.ID) -} - -// PortToLayerThree fetches the specified device, finds the matching port by -// name, and converts it to layer3. A port may already be in a layer3 mode, in -// which case the port will be returned with a nil response and nil error with -// no additional action taking place. -// -// When switching to Layer3, a new set of IP addresses will be requested -// including Public IPv4, Public IPv6, and Private IPv6 addresses. -// -// Deprecated: use PortServiceOp.ConvertToLayerTwo -func (i *DevicePortServiceOp) PortToLayerThree(deviceID, portName string) (*Port, *Response, error) { - p, err := i.GetPortByName(deviceID, portName) - if err != nil { - return nil, nil, err - } - if (p.NetworkType == NetworkTypeL3) || (p.NetworkType == NetworkTypeHybrid) { - return p, nil, nil - } - - ips := []AddressRequest{ - {AddressFamily: 4, Public: true}, - {AddressFamily: 4, Public: false}, - {AddressFamily: 6, Public: true}, - } - - return i.client.Ports.ConvertToLayerThree(p.ID, ips) -} - -// DeviceNetworkType fetches the specified Device and returns a heuristic single -// word network type consistent with the Equinix Metal console experience. -// -// Deprecated: use Device.GetNetworkType -func (i *DevicePortServiceOp) DeviceNetworkType(deviceID string) (string, error) { - d, _, err := i.client.Devices.Get(deviceID, nil) - if err != nil { - return "", err - } - return d.GetNetworkType(), nil -} - -// GetAllEthPorts fetches the specified Device and returns a heuristic single -// word network type consistent with the Equinix Metal console experience. -// -// Deprecated: use Device.GetPhysicalPorts -func (i *DevicePortServiceOp) GetAllEthPorts(d *Device) (map[string]*Port, error) { - d, _, err := i.client.Devices.Get(d.ID, nil) - if err != nil { - return nil, err - } - return d.GetPhysicalPorts(), nil -} - -// GetOddEthPorts fetches the specified Device and returns physical -// ports eth1 and eth3. -// -// Deprecated: use Device.GetPhysicalPorts and filter the map to only the keys -// ending with odd digits -func (i *DevicePortServiceOp) GetOddEthPorts(d *Device) (map[string]*Port, error) { - d, _, err := i.client.Devices.Get(d.ID, nil) - if err != nil { - return nil, err - } - ret := map[string]*Port{} - eth1, err := d.GetPortByName("eth1") - if err != nil { - return nil, err - } - ret["eth1"] = eth1 - - eth3, err := d.GetPortByName("eth3") - if err != nil { - return ret, nil - } - ret["eth3"] = eth3 - return ret, nil - -} - -// ConvertDevice converts the specified device's network ports (including -// addresses and vlans) to the named network type, consistent with the Equinix -// Metal console experience. -// -// Deprecated: Equinix Metal devices may support more than two ports and the -// whole-device single word network type can no longer capture the capabilities -// and permutations of device port configurations. -func (i *DevicePortServiceOp) ConvertDevice(d *Device, targetType string) error { - bondPorts := d.GetBondPorts() - - if targetType == NetworkTypeL3 { - // TODO: remove vlans from all the ports - for _, p := range bondPorts { - _, _, err := i.Bond(p, false) - if err != nil { - return err - } - } - _, _, err := i.PortToLayerThree(d.ID, "bond0") - if err != nil { - return err - } - allEthPorts, err := i.GetAllEthPorts(d) - if err != nil { - return err - } - for _, p := range allEthPorts { - _, _, err := i.Bond(p, false) - if err != nil { - return err - } - } - } - if targetType == NetworkTypeHybrid { - for _, p := range bondPorts { - _, _, err := i.Bond(p, false) - if err != nil { - return err - } - } - - _, _, err := i.PortToLayerThree(d.ID, "bond0") - if err != nil { - return err - } - - // ports need to be refreshed before bonding/disbonding - oddEthPorts, err := i.GetOddEthPorts(d) - if err != nil { - return err - } - - for _, p := range oddEthPorts { - _, _, err := i.Disbond(p, false) - if err != nil { - return err - } - } - } - if targetType == NetworkTypeL2Individual { - _, _, err := i.PortToLayerTwo(d.ID, "bond0") - if err != nil { - return err - } - for _, p := range bondPorts { - _, _, err = i.Disbond(p, true) - if err != nil { - return err - } - } - } - if targetType == NetworkTypeL2Bonded { - - for _, p := range bondPorts { - _, _, err := i.PortToLayerTwo(d.ID, p.Name) - if err != nil { - return err - } - } - allEthPorts, err := i.GetAllEthPorts(d) - if err != nil { - return err - } - for _, p := range allEthPorts { - _, _, err := i.Bond(p, false) - if err != nil { - return err - } - } - } - return nil -} - -// DeviceToNetworkType fetches the specified device and converts its network -// ports (including addresses and vlans) to the named network type, consistent -// with the Equinix Metal console experience. -// -// Deprecated: use DevicePortServiceOp.ConvertDevice which this function thinly -// wraps. -func (i *DevicePortServiceOp) DeviceToNetworkType(deviceID string, targetType string) (*Device, error) { - d, _, err := i.client.Devices.Get(deviceID, nil) - if err != nil { - return nil, err - } - - curType := d.GetNetworkType() - - if curType == targetType { - return nil, fmt.Errorf("Device already is in state %s", targetType) - } - err = i.ConvertDevice(d, targetType) - if err != nil { - return nil, err - } - - d, _, err = i.client.Devices.Get(deviceID, nil) - - if err != nil { - return nil, err - } - - finalType := d.GetNetworkType() - - if finalType != targetType { - return nil, fmt.Errorf( - "Failed to convert device %s from %s to %s. New type was %s", - deviceID, curType, targetType, finalType) - - } - return d, err -} diff --git a/vendor/github.com/packethost/packngo/devices.go b/vendor/github.com/packethost/packngo/devices.go deleted file mode 100644 index 35a5eaea..00000000 --- a/vendor/github.com/packethost/packngo/devices.go +++ /dev/null @@ -1,501 +0,0 @@ -package packngo - -import ( - "fmt" - "path" -) - -const deviceBasePath = "/devices" - -const ( - NetworkTypeHybrid = "hybrid" - NetworkTypeL2Bonded = "layer2-bonded" - NetworkTypeL2Individual = "layer2-individual" - NetworkTypeL3 = "layer3" -) - -// DeviceService interface defines available device methods -type DeviceService interface { - List(ProjectID string, opts *ListOptions) ([]Device, *Response, error) - Get(DeviceID string, opts *GetOptions) (*Device, *Response, error) - Create(*DeviceCreateRequest) (*Device, *Response, error) - Update(string, *DeviceUpdateRequest) (*Device, *Response, error) - Delete(string, bool) (*Response, error) - Reboot(string) (*Response, error) - PowerOff(string) (*Response, error) - PowerOn(string) (*Response, error) - Lock(string) (*Response, error) - Unlock(string) (*Response, error) - ListBGPSessions(deviceID string, opts *ListOptions) ([]BGPSession, *Response, error) - ListBGPNeighbors(deviceID string, opts *ListOptions) ([]BGPNeighbor, *Response, error) - ListEvents(deviceID string, opts *ListOptions) ([]Event, *Response, error) -} - -type devicesRoot struct { - Devices []Device `json:"devices"` - Meta meta `json:"meta"` -} - -// Device represents an Equinix Metal device from API -type Device struct { - ID string `json:"id"` - Href string `json:"href,omitempty"` - Hostname string `json:"hostname,omitempty"` - Description *string `json:"description,omitempty"` - State string `json:"state,omitempty"` - Created string `json:"created_at,omitempty"` - Updated string `json:"updated_at,omitempty"` - Locked bool `json:"locked,omitempty"` - BillingCycle string `json:"billing_cycle,omitempty"` - Storage *CPR `json:"storage,omitempty"` - Tags []string `json:"tags,omitempty"` - Network []*IPAddressAssignment `json:"ip_addresses"` - Volumes []*Volume `json:"volumes"` - OS *OS `json:"operating_system,omitempty"` - Plan *Plan `json:"plan,omitempty"` - Facility *Facility `json:"facility,omitempty"` - Metro *Metro `json:"metro,omitempty"` - Project *Project `json:"project,omitempty"` - ProvisionEvents []*Event `json:"provisioning_events,omitempty"` - ProvisionPer float32 `json:"provisioning_percentage,omitempty"` - UserData string `json:"userdata,omitempty"` - User string `json:"user,omitempty"` - RootPassword string `json:"root_password,omitempty"` - IPXEScriptURL string `json:"ipxe_script_url,omitempty"` - AlwaysPXE bool `json:"always_pxe,omitempty"` - HardwareReservation Href `json:"hardware_reservation,omitempty"` - SpotInstance bool `json:"spot_instance,omitempty"` - SpotPriceMax float64 `json:"spot_price_max,omitempty"` - TerminationTime *Timestamp `json:"termination_time,omitempty"` - NetworkPorts []Port `json:"network_ports,omitempty"` - CustomData map[string]interface{} `json:"customdata,omitempty"` - SSHKeys []SSHKey `json:"ssh_keys,omitempty"` - ShortID string `json:"short_id,omitempty"` - SwitchUUID string `json:"switch_uuid,omitempty"` -} - -type NetworkInfo struct { - PublicIPv4 string - PublicIPv6 string - PrivateIPv4 string -} - -func (d *Device) GetNetworkInfo() NetworkInfo { - ni := NetworkInfo{} - for _, ip := range d.Network { - // Initial device IPs are fixed and marked as "Management" - if ip.Management { - if ip.AddressFamily == 4 { - if ip.Public { - ni.PublicIPv4 = ip.Address - } else { - ni.PrivateIPv4 = ip.Address - } - } else { - ni.PublicIPv6 = ip.Address - } - } - } - return ni -} - -func (d Device) String() string { - return Stringify(d) -} - -func (d *Device) NumOfBonds() int { - numOfBonds := 0 - for _, p := range d.NetworkPorts { - if p.Type == "NetworkBondPort" { - numOfBonds++ - } - } - return numOfBonds -} - -func (d *Device) GetPortsInBond(name string) map[string]*Port { - ports := map[string]*Port{} - for _, port := range d.NetworkPorts { - if port.Bond != nil && port.Bond.Name == name { - p := port - ports[p.Name] = &p - } - } - return ports -} - -func (d *Device) GetBondPorts() map[string]*Port { - ports := map[string]*Port{} - for _, port := range d.NetworkPorts { - if port.Type == "NetworkBondPort" { - p := port - ports[p.Name] = &p - } - } - return ports -} - -func (d *Device) GetPhysicalPorts() map[string]*Port { - ports := map[string]*Port{} - for _, port := range d.NetworkPorts { - if port.Type == "NetworkPort" { - p := port - ports[p.Name] = &p - } - } - return ports -} - -func (d *Device) GetPortByName(name string) (*Port, error) { - for _, port := range d.NetworkPorts { - if port.Name == name { - return &port, nil - } - } - return nil, fmt.Errorf("Port %s not found in device %s", name, d.ID) -} - -type ports map[string]*Port - -func (ports ports) allBonded() bool { - if ports == nil { - return false - } - - if len(ports) == 0 { - return false - } - - for _, p := range ports { - if (p == nil) || (!p.Data.Bonded) { - return false - } - } - return true -} - -func (d *Device) HasManagementIPs() bool { - for _, ip := range d.Network { - if ip.Management { - return true - } - } - return false -} - -// GetNetworkType returns a composite network type identification for a device -// based on the plan, network_type, and IP management state of the device. -// GetNetworkType provides the same composite state rendered in the Packet -// Portal for a given device. -func (d *Device) GetNetworkType() string { - if d.Plan != nil { - if d.Plan.Slug == "baremetal_0" || d.Plan.Slug == "baremetal_1" { - return NetworkTypeL3 - } - if d.Plan.Slug == "baremetal_1e" { - return NetworkTypeHybrid - } - } - - bonds := ports(d.GetBondPorts()) - phys := ports(d.GetPhysicalPorts()) - - if bonds.allBonded() { - if phys.allBonded() { - if !d.HasManagementIPs() { - return NetworkTypeL2Bonded - } - return NetworkTypeL3 - } - return NetworkTypeHybrid - } - return NetworkTypeL2Individual -} - -type IPAddressCreateRequest struct { - // Address Family for IP Address - AddressFamily int `json:"address_family"` - - // Address Type for IP Address - Public bool `json:"public"` - - // CIDR Size for the IP Block created. Valid values depends on the operating system provisioned. - CIDR int `json:"cidr,omitempty"` - - // Reservations are UUIDs of any IP reservations to use when assigning IPs - Reservations []string `json:"ip_reservations,omitempty"` -} - -// CPR is a struct for custom partitioning and RAID -// If you don't want to bother writing the struct, just write the CPR conf to -// a string and then do -// -// var cpr CPR -// err := json.Unmarshal([]byte(cprString), &cpr) -// if err != nil { -// log.Fatal(err) -// } -type CPR struct { - Disks []struct { - Device string `json:"device"` - WipeTable bool `json:"wipeTable"` - Partitions []struct { - Label string `json:"label"` - Number int `json:"number"` - Size string `json:"size"` - } `json:"partitions"` - } `json:"disks"` - Raid []struct { - Devices []string `json:"devices"` - Level string `json:"level"` - Name string `json:"name"` - } `json:"raid,omitempty"` - Filesystems []struct { - Mount struct { - Device string `json:"device"` - Format string `json:"format"` - Point string `json:"point"` - Create struct { - Options []string `json:"options"` - } `json:"create"` - } `json:"mount"` - } `json:"filesystems"` -} - -// DeviceCreateRequest type used to create an Equinix Metal device -type DeviceCreateRequest struct { - Hostname string `json:"hostname"` - Plan string `json:"plan"` - Facility []string `json:"facility,omitempty"` - Metro string `json:"metro,omitempty"` - OS string `json:"operating_system"` - BillingCycle string `json:"billing_cycle"` - ProjectID string `json:"project_id"` - UserData string `json:"userdata"` - Storage *CPR `json:"storage,omitempty"` - Tags []string `json:"tags"` - Description string `json:"description,omitempty"` - IPXEScriptURL string `json:"ipxe_script_url,omitempty"` - PublicIPv4SubnetSize int `json:"public_ipv4_subnet_size,omitempty"` - AlwaysPXE bool `json:"always_pxe,omitempty"` - HardwareReservationID string `json:"hardware_reservation_id,omitempty"` - SpotInstance bool `json:"spot_instance,omitempty"` - SpotPriceMax float64 `json:"spot_price_max,omitempty,string"` - TerminationTime *Timestamp `json:"termination_time,omitempty"` - CustomData string `json:"customdata,omitempty"` - // UserSSHKeys is a list of user UUIDs - essentially a list of - // collaborators. The users must be a collaborator in the same project - // where the device is created. The user's SSH keys then go to the - // device - UserSSHKeys []string `json:"user_ssh_keys,omitempty"` - // Project SSHKeys is a list of SSHKeys resource UUIDs. If this param - // is supplied, only the listed SSHKeys will go to the device. - // Any other Project SSHKeys and any User SSHKeys will not be present - // in the device. - ProjectSSHKeys []string `json:"project_ssh_keys,omitempty"` - Features map[string]string `json:"features,omitempty"` - IPAddresses []IPAddressCreateRequest `json:"ip_addresses,omitempty"` -} - -// DeviceUpdateRequest type used to update an Equinix Metal device -type DeviceUpdateRequest struct { - Hostname *string `json:"hostname,omitempty"` - Description *string `json:"description,omitempty"` - UserData *string `json:"userdata,omitempty"` - Locked *bool `json:"locked,omitempty"` - Tags *[]string `json:"tags,omitempty"` - AlwaysPXE *bool `json:"always_pxe,omitempty"` - IPXEScriptURL *string `json:"ipxe_script_url,omitempty"` - CustomData *string `json:"customdata,omitempty"` -} - -func (d DeviceCreateRequest) String() string { - return Stringify(d) -} - -// DeviceActionRequest type used to execute actions on devices -type DeviceActionRequest struct { - Type string `json:"type"` -} - -type DeviceDeleteRequest struct { - Force bool `json:"force_delete"` -} - -func (d DeviceActionRequest) String() string { - return Stringify(d) -} - -// DeviceServiceOp implements DeviceService -type DeviceServiceOp struct { - client *Client -} - -// List returns devices on a project -// -// Regarding ListOptions.Search: The API documentation does not provide guidance -// on the fields that will be searched using this parameter, so this behavior is -// undefined and prone to change. -// -// As of 2020-10-20, ListOptions.Search will look for matches in the following -// Device properties: Hostname, Description, Tags, ID, ShortID, Network.Address, -// Plan.Name, Plan.Slug, Facility.Code, Facility.Name, OS.Name, OS.Slug, -// HardwareReservation.ID, HardwareReservation.ShortID -func (s *DeviceServiceOp) List(projectID string, opts *ListOptions) (devices []Device, resp *Response, err error) { - opts = opts.Including("facility") - endpointPath := path.Join(projectBasePath, projectID, deviceBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - - for { - subset := new(devicesRoot) - - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - devices = append(devices, subset.Devices...) - - if apiPathQuery = nextPage(subset.Meta, opts); apiPathQuery != "" { - continue - } - - return - } -} - -// Get returns a device by id -func (s *DeviceServiceOp) Get(deviceID string, opts *GetOptions) (*Device, *Response, error) { - opts = opts.Including("facility") - endpointPath := path.Join(deviceBasePath, deviceID) - apiPathQuery := opts.WithQuery(endpointPath) - device := new(Device) - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, device) - if err != nil { - return nil, resp, err - } - return device, resp, err -} - -// Create creates a new device -func (s *DeviceServiceOp) Create(createRequest *DeviceCreateRequest) (*Device, *Response, error) { - apiPath := path.Join(projectBasePath, createRequest.ProjectID, deviceBasePath) - device := new(Device) - - resp, err := s.client.DoRequest("POST", apiPath, createRequest, device) - if err != nil { - return nil, resp, err - } - return device, resp, err -} - -// Update updates an existing device -func (s *DeviceServiceOp) Update(deviceID string, updateRequest *DeviceUpdateRequest) (*Device, *Response, error) { - opts := &GetOptions{} - opts = opts.Including("facility") - endpointPath := path.Join(deviceBasePath, deviceID) - apiPathQuery := opts.WithQuery(endpointPath) - device := new(Device) - - resp, err := s.client.DoRequest("PUT", apiPathQuery, updateRequest, device) - if err != nil { - return nil, resp, err - } - - return device, resp, err -} - -// Delete deletes a device -func (s *DeviceServiceOp) Delete(deviceID string, force bool) (*Response, error) { - apiPath := path.Join(deviceBasePath, deviceID) - req := &DeviceDeleteRequest{Force: force} - - return s.client.DoRequest("DELETE", apiPath, req, nil) -} - -// Reboot reboots on a device -func (s *DeviceServiceOp) Reboot(deviceID string) (*Response, error) { - apiPath := path.Join(deviceBasePath, deviceID, "actions") - action := &DeviceActionRequest{Type: "reboot"} - - return s.client.DoRequest("POST", apiPath, action, nil) -} - -// PowerOff powers on a device -func (s *DeviceServiceOp) PowerOff(deviceID string) (*Response, error) { - apiPath := path.Join(deviceBasePath, deviceID, "actions") - action := &DeviceActionRequest{Type: "power_off"} - - return s.client.DoRequest("POST", apiPath, action, nil) -} - -// PowerOn powers on a device -func (s *DeviceServiceOp) PowerOn(deviceID string) (*Response, error) { - apiPath := path.Join(deviceBasePath, deviceID, "actions") - action := &DeviceActionRequest{Type: "power_on"} - - return s.client.DoRequest("POST", apiPath, action, nil) -} - -type lockType struct { - Locked bool `json:"locked"` -} - -// Lock sets a device to "locked" -func (s *DeviceServiceOp) Lock(deviceID string) (*Response, error) { - apiPath := path.Join(deviceBasePath, deviceID) - action := lockType{Locked: true} - - return s.client.DoRequest("PATCH", apiPath, action, nil) -} - -// Unlock sets a device to "unlocked" -func (s *DeviceServiceOp) Unlock(deviceID string) (*Response, error) { - apiPath := path.Join(deviceBasePath, deviceID) - action := lockType{Locked: false} - - return s.client.DoRequest("PATCH", apiPath, action, nil) -} - -func (s *DeviceServiceOp) ListBGPNeighbors(deviceID string, opts *ListOptions) ([]BGPNeighbor, *Response, error) { - root := new(bgpNeighborsRoot) - endpointPath := path.Join(deviceBasePath, deviceID, bgpNeighborsBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, root) - if err != nil { - return nil, resp, err - } - - return root.BGPNeighbors, resp, err -} - -// ListBGPSessions returns all BGP Sessions associated with the device -func (s *DeviceServiceOp) ListBGPSessions(deviceID string, opts *ListOptions) (bgpSessions []BGPSession, resp *Response, err error) { - - endpointPath := path.Join(deviceBasePath, deviceID, bgpSessionBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - - for { - subset := new(bgpSessionsRoot) - - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - bgpSessions = append(bgpSessions, subset.Sessions...) - - if apiPathQuery = nextPage(subset.Meta, opts); apiPathQuery != "" { - continue - } - return - } -} - -// ListEvents returns list of device events -func (s *DeviceServiceOp) ListEvents(deviceID string, opts *ListOptions) ([]Event, *Response, error) { - apiPath := path.Join(deviceBasePath, deviceID, eventBasePath) - - return listEvents(s.client, apiPath, opts) -} diff --git a/vendor/github.com/packethost/packngo/doc.go b/vendor/github.com/packethost/packngo/doc.go deleted file mode 100644 index 52a192a0..00000000 --- a/vendor/github.com/packethost/packngo/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package packngo implements the Equinix Metal API -// documented at https://metal.equinix.com/developers/api. -package packngo diff --git a/vendor/github.com/packethost/packngo/email.go b/vendor/github.com/packethost/packngo/email.go deleted file mode 100644 index e82ed32d..00000000 --- a/vendor/github.com/packethost/packngo/email.go +++ /dev/null @@ -1,89 +0,0 @@ -package packngo - -import ( - "path" -) - -const emailBasePath = "/emails" - -// EmailRequest type used to add an email address to the current user -type EmailRequest struct { - Address string `json:"address,omitempty"` - Default *bool `json:"default,omitempty"` -} - -// EmailService interface defines available email methods -type EmailService interface { - Get(string, *GetOptions) (*Email, *Response, error) - Create(*EmailRequest) (*Email, *Response, error) - Update(string, *EmailRequest) (*Email, *Response, error) - Delete(string) (*Response, error) -} - -// Email represents a user's email address -type Email struct { - ID string `json:"id"` - Address string `json:"address"` - Default bool `json:"default,omitempty"` - URL string `json:"href,omitempty"` -} - -func (e Email) String() string { - return Stringify(e) -} - -// EmailServiceOp implements EmailService -type EmailServiceOp struct { - client *Client -} - -// Get retrieves an email by id -func (s *EmailServiceOp) Get(emailID string, opts *GetOptions) (*Email, *Response, error) { - endpointPath := path.Join(emailBasePath, emailID) - apiPathQuery := opts.WithQuery(endpointPath) - email := new(Email) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, email) - if err != nil { - return nil, resp, err - } - - return email, resp, err -} - -// Create adds a new email address to the current user. -func (s *EmailServiceOp) Create(request *EmailRequest) (*Email, *Response, error) { - email := new(Email) - - resp, err := s.client.DoRequest("POST", emailBasePath, request, email) - if err != nil { - return nil, resp, err - } - - return email, resp, err -} - -// Delete removes the email address from the current user account -func (s *EmailServiceOp) Delete(emailID string) (*Response, error) { - apiPath := path.Join(emailBasePath, emailID) - - resp, err := s.client.DoRequest("DELETE", apiPath, nil, nil) - if err != nil { - return resp, err - } - - return resp, err -} - -// Update email parameters -func (s *EmailServiceOp) Update(emailID string, request *EmailRequest) (*Email, *Response, error) { - email := new(Email) - apiPath := path.Join(emailBasePath, emailID) - - resp, err := s.client.DoRequest("PUT", apiPath, request, email) - if err != nil { - return nil, resp, err - } - - return email, resp, err -} diff --git a/vendor/github.com/packethost/packngo/events.go b/vendor/github.com/packethost/packngo/events.go deleted file mode 100644 index cfc7bcc3..00000000 --- a/vendor/github.com/packethost/packngo/events.go +++ /dev/null @@ -1,81 +0,0 @@ -package packngo - -import ( - "path" -) - -const eventBasePath = "/events" - -// Event struct -type Event struct { - ID string `json:"id,omitempty"` - State string `json:"state,omitempty"` - Type string `json:"type,omitempty"` - Body string `json:"body,omitempty"` - Relationships []Href `json:"relationships,omitempty"` - Interpolated string `json:"interpolated,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - Href string `json:"href,omitempty"` -} - -type eventsRoot struct { - Events []Event `json:"events,omitempty"` - Meta meta `json:"meta,omitempty"` -} - -// EventService interface defines available event functions -type EventService interface { - List(*ListOptions) ([]Event, *Response, error) - Get(string, *GetOptions) (*Event, *Response, error) -} - -// EventServiceOp implements EventService -type EventServiceOp struct { - client *Client -} - -// List returns all events -func (s *EventServiceOp) List(listOpt *ListOptions) ([]Event, *Response, error) { - return listEvents(s.client, eventBasePath, listOpt) -} - -// Get returns an event by ID -func (s *EventServiceOp) Get(eventID string, getOpt *GetOptions) (*Event, *Response, error) { - apiPath := path.Join(eventBasePath, eventID) - return get(s.client, apiPath, getOpt) -} - -// list helper function for all event functions -func listEvents(client requestDoer, endpointPath string, opts *ListOptions) (events []Event, resp *Response, err error) { - apiPathQuery := opts.WithQuery(endpointPath) - - for { - subset := new(eventsRoot) - - resp, err = client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - events = append(events, subset.Events...) - - if apiPathQuery = nextPage(subset.Meta, opts); apiPathQuery != "" { - continue - } - return - } - -} - -func get(client *Client, endpointPath string, opts *GetOptions) (*Event, *Response, error) { - event := new(Event) - - apiPathQuery := opts.WithQuery(endpointPath) - - resp, err := client.DoRequest("GET", apiPathQuery, nil, event) - if err != nil { - return nil, resp, err - } - - return event, resp, err -} diff --git a/vendor/github.com/packethost/packngo/facilities.go b/vendor/github.com/packethost/packngo/facilities.go deleted file mode 100644 index 91c21d79..00000000 --- a/vendor/github.com/packethost/packngo/facilities.go +++ /dev/null @@ -1,54 +0,0 @@ -package packngo - -const facilityBasePath = "/facilities" - -// FacilityService interface defines available facility methods -type FacilityService interface { - List(*ListOptions) ([]Facility, *Response, error) -} - -type facilityRoot struct { - Facilities []Facility `json:"facilities"` -} - -// Facility represents an Equinix Metal facility -type Facility struct { - ID string `json:"id"` - Name string `json:"name,omitempty"` - Code string `json:"code,omitempty"` - Features []string `json:"features,omitempty"` - Address *Address `json:"address,omitempty"` - Metro *Metro `json:"metro,omitempty"` - URL string `json:"href,omitempty"` -} - -func (f Facility) String() string { - return Stringify(f) -} - -// Address - the physical address of the facility -type Address struct { - ID string `json:"id,omitempty"` -} - -func (a Address) String() string { - return Stringify(a) -} - -// FacilityServiceOp implements FacilityService -type FacilityServiceOp struct { - client *Client -} - -// List returns all facilities -func (s *FacilityServiceOp) List(opts *ListOptions) ([]Facility, *Response, error) { - root := new(facilityRoot) - apiPathQuery := opts.WithQuery(facilityBasePath) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, root) - if err != nil { - return nil, resp, err - } - - return root.Facilities, resp, err -} diff --git a/vendor/github.com/packethost/packngo/hardware_reservations.go b/vendor/github.com/packethost/packngo/hardware_reservations.go deleted file mode 100644 index 13cdc9ee..00000000 --- a/vendor/github.com/packethost/packngo/hardware_reservations.go +++ /dev/null @@ -1,94 +0,0 @@ -package packngo - -import ( - "path" -) - -const hardwareReservationBasePath = "/hardware-reservations" - -// HardwareReservationService interface defines available hardware reservation functions -type HardwareReservationService interface { - Get(hardwareReservationID string, getOpt *GetOptions) (*HardwareReservation, *Response, error) - List(projectID string, listOpt *ListOptions) ([]HardwareReservation, *Response, error) - Move(string, string) (*HardwareReservation, *Response, error) -} - -// HardwareReservationServiceOp implements HardwareReservationService -type HardwareReservationServiceOp struct { - client *Client -} - -// HardwareReservation struct -type HardwareReservation struct { - ID string `json:"id,omitempty"` - ShortID string `json:"short_id,omitempty"` - Facility Facility `json:"facility,omitempty"` - Plan Plan `json:"plan,omitempty"` - Provisionable bool `json:"provisionable,omitempty"` - Spare bool `json:"spare,omitempty"` - SwitchUUID string `json:"switch_uuid,omitempty"` - Intervals int `json:"intervals,omitempty"` - CurrentPeriod int `json:"current_period,omitempty"` - Href string `json:"href,omitempty"` - Project Project `json:"project,omitempty"` - Device *Device `json:"device,omitempty"` - CreatedAt Timestamp `json:"created_at,omitempty"` -} - -type hardwareReservationRoot struct { - HardwareReservations []HardwareReservation `json:"hardware_reservations"` - Meta meta `json:"meta"` -} - -// List returns all hardware reservations for a given project -func (s *HardwareReservationServiceOp) List(projectID string, opts *ListOptions) (reservations []HardwareReservation, resp *Response, err error) { - root := new(hardwareReservationRoot) - - endpointPath := path.Join(projectBasePath, projectID, hardwareReservationBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - - for { - subset := new(hardwareReservationRoot) - - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, root) - if err != nil { - return nil, resp, err - } - - reservations = append(reservations, root.HardwareReservations...) - if apiPathQuery = nextPage(subset.Meta, opts); apiPathQuery != "" { - continue - } - return - } -} - -// Get returns a single hardware reservation -func (s *HardwareReservationServiceOp) Get(hardwareReservationdID string, opts *GetOptions) (*HardwareReservation, *Response, error) { - hardwareReservation := new(HardwareReservation) - - endpointPath := path.Join(hardwareReservationBasePath, hardwareReservationdID) - apiPathQuery := opts.WithQuery(endpointPath) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, hardwareReservation) - if err != nil { - return nil, resp, err - } - - return hardwareReservation, resp, err -} - -// Move a hardware reservation to another project -func (s *HardwareReservationServiceOp) Move(hardwareReservationdID, projectID string) (*HardwareReservation, *Response, error) { - hardwareReservation := new(HardwareReservation) - apiPath := path.Join(hardwareReservationBasePath, hardwareReservationdID, "move") - body := map[string]string{} - body["project_id"] = projectID - - resp, err := s.client.DoRequest("POST", apiPath, body, hardwareReservation) - if err != nil { - return nil, resp, err - } - - return hardwareReservation, resp, err -} diff --git a/vendor/github.com/packethost/packngo/ip.go b/vendor/github.com/packethost/packngo/ip.go deleted file mode 100644 index 8e3afc7d..00000000 --- a/vendor/github.com/packethost/packngo/ip.go +++ /dev/null @@ -1,245 +0,0 @@ -package packngo - -import ( - "fmt" - "path" -) - -const ipBasePath = "/ips" - -const ( - // PublicIPv4 fixed string representation of public ipv4 - PublicIPv4 = "public_ipv4" - // PrivateIPv4 fixed string representation of private ipv4 - PrivateIPv4 = "private_ipv4" - // GlobalIPv4 fixed string representation of global ipv4 - GlobalIPv4 = "global_ipv4" - // PublicIPv6 fixed string representation of public ipv6 - PublicIPv6 = "public_ipv6" - // PrivateIPv6 fixed string representation of private ipv6 - PrivateIPv6 = "private_ipv6" - // GlobalIPv6 fixed string representation of global ipv6 - GlobalIPv6 = "global_ipv6" -) - -// DeviceIPService handles assignment of addresses from reserved blocks to instances in a project. -type DeviceIPService interface { - Assign(deviceID string, assignRequest *AddressStruct) (*IPAddressAssignment, *Response, error) - Unassign(assignmentID string) (*Response, error) - Get(assignmentID string, getOpt *GetOptions) (*IPAddressAssignment, *Response, error) - List(deviceID string, opts *ListOptions) ([]IPAddressAssignment, *Response, error) -} - -// ProjectIPService handles reservation of IP address blocks for a project. -type ProjectIPService interface { - Get(reservationID string, getOpt *GetOptions) (*IPAddressReservation, *Response, error) - List(projectID string, opts *ListOptions) ([]IPAddressReservation, *Response, error) - Request(projectID string, ipReservationReq *IPReservationRequest) (*IPAddressReservation, *Response, error) - Remove(ipReservationID string) (*Response, error) - AvailableAddresses(ipReservationID string, r *AvailableRequest) ([]string, *Response, error) -} - -type IpAddressCommon struct { //nolint:golint - ID string `json:"id"` - Address string `json:"address"` - Gateway string `json:"gateway"` - Network string `json:"network"` - AddressFamily int `json:"address_family"` - Netmask string `json:"netmask"` - Public bool `json:"public"` - CIDR int `json:"cidr"` - Created string `json:"created_at,omitempty"` - Updated string `json:"updated_at,omitempty"` - Href string `json:"href"` - Management bool `json:"management"` - Manageable bool `json:"manageable"` - Metro *Metro `json:"metro,omitempty"` - Project Href `json:"project"` - Global *bool `json:"global_ip"` - Tags []string `json:"tags,omitempty"` - CustomData interface{} `json:"customdata,omitempty"` -} - -// IPAddressReservation is created when user sends IP reservation request for a project (considering it's within quota). -type IPAddressReservation struct { - IpAddressCommon - Assignments []*IPAddressAssignment `json:"assignments"` - Facility *Facility `json:"facility,omitempty"` - Available string `json:"available"` - Addon bool `json:"addon"` - Bill bool `json:"bill"` - Description *string `json:"details"` -} - -// AvailableResponse is a type for listing of available addresses from a reserved block. -type AvailableResponse struct { - Available []string `json:"available"` -} - -// AvailableRequest is a type for listing available addresses from a reserved block. -type AvailableRequest struct { - CIDR int `json:"cidr"` -} - -// IPAddressAssignment is created when an IP address from reservation block is assigned to a device. -type IPAddressAssignment struct { - IpAddressCommon - AssignedTo Href `json:"assigned_to"` -} - -// IPReservationRequest represents the body of a reservation request. -type IPReservationRequest struct { - Type string `json:"type"` - Quantity int `json:"quantity"` - Description string `json:"details,omitempty"` - Facility *string `json:"facility,omitempty"` - Metro *string `json:"metro,omitempty"` - Tags []string `json:"tags,omitempty"` - CustomData interface{} `json:"customdata,omitempty"` - // FailOnApprovalRequired if the IP request cannot be approved automatically, rather than sending to - // the longer Equinix Metal approval process, fail immediately with a 422 error - FailOnApprovalRequired bool `json:"fail_on_approval_required,omitempty"` -} - -// AddressStruct is a helper type for request/response with dict like {"address": ... } -type AddressStruct struct { - Address string `json:"address"` -} - -func deleteFromIP(client *Client, resourceID string) (*Response, error) { - apiPath := path.Join(ipBasePath, resourceID) - - return client.DoRequest("DELETE", apiPath, nil, nil) -} - -func (i IPAddressReservation) String() string { - return Stringify(i) -} - -func (i IPAddressAssignment) String() string { - return Stringify(i) -} - -// DeviceIPServiceOp is interface for IP-address assignment methods. -type DeviceIPServiceOp struct { - client *Client -} - -// Unassign unassigns an IP address from the device to which it is currently assigned. -// This will remove the relationship between an IP and the device and will make the IP -// address available to be assigned to another device. -func (i *DeviceIPServiceOp) Unassign(assignmentID string) (*Response, error) { - return deleteFromIP(i.client, assignmentID) -} - -// Assign assigns an IP address to a device. -// The IP address must be in one of the IP ranges assigned to the device’s project. -func (i *DeviceIPServiceOp) Assign(deviceID string, assignRequest *AddressStruct) (*IPAddressAssignment, *Response, error) { - apiPath := path.Join(deviceBasePath, deviceID, ipBasePath) - ipa := new(IPAddressAssignment) - - resp, err := i.client.DoRequest("POST", apiPath, assignRequest, ipa) - if err != nil { - return nil, resp, err - } - - return ipa, resp, err -} - -// Get returns assignment by ID. -func (i *DeviceIPServiceOp) Get(assignmentID string, opts *GetOptions) (*IPAddressAssignment, *Response, error) { - endpointPath := path.Join(ipBasePath, assignmentID) - apiPathQuery := opts.WithQuery(endpointPath) - ipa := new(IPAddressAssignment) - - resp, err := i.client.DoRequest("GET", apiPathQuery, nil, ipa) - if err != nil { - return nil, resp, err - } - - return ipa, resp, err -} - -// List list all of the IP address assignments on a device -func (i *DeviceIPServiceOp) List(deviceID string, opts *ListOptions) ([]IPAddressAssignment, *Response, error) { - endpointPath := path.Join(deviceBasePath, deviceID, ipBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - - //ipList represents collection of IP Address reservations - type ipList struct { - IPs []IPAddressAssignment `json:"ip_addresses,omitempty"` - } - - ips := new(ipList) - - resp, err := i.client.DoRequest("GET", apiPathQuery, nil, ips) - if err != nil { - return nil, resp, err - } - - return ips.IPs, resp, err -} - -// ProjectIPServiceOp is interface for IP assignment methods. -type ProjectIPServiceOp struct { - client *Client -} - -// Get returns reservation by ID. -func (i *ProjectIPServiceOp) Get(reservationID string, opts *GetOptions) (*IPAddressReservation, *Response, error) { - endpointPath := path.Join(ipBasePath, reservationID) - apiPathQuery := opts.WithQuery(endpointPath) - ipr := new(IPAddressReservation) - - resp, err := i.client.DoRequest("GET", apiPathQuery, nil, ipr) - if err != nil { - return nil, resp, err - } - - return ipr, resp, err -} - -// List provides a list of IP resevations for a single project. -func (i *ProjectIPServiceOp) List(projectID string, opts *ListOptions) ([]IPAddressReservation, *Response, error) { - endpointPath := path.Join(projectBasePath, projectID, ipBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - reservations := new(struct { - Reservations []IPAddressReservation `json:"ip_addresses"` - }) - - resp, err := i.client.DoRequest("GET", apiPathQuery, nil, reservations) - if err != nil { - return nil, resp, err - } - return reservations.Reservations, resp, nil -} - -// Request requests more IP space for a project in order to have additional IP addresses to assign to devices. -func (i *ProjectIPServiceOp) Request(projectID string, ipReservationReq *IPReservationRequest) (*IPAddressReservation, *Response, error) { - apiPath := path.Join(projectBasePath, projectID, ipBasePath) - ipr := new(IPAddressReservation) - - resp, err := i.client.DoRequest("POST", apiPath, ipReservationReq, ipr) - if err != nil { - return nil, resp, err - } - return ipr, resp, err -} - -// Remove removes an IP reservation from the project. -func (i *ProjectIPServiceOp) Remove(ipReservationID string) (*Response, error) { - return deleteFromIP(i.client, ipReservationID) -} - -// AvailableAddresses lists addresses available from a reserved block -func (i *ProjectIPServiceOp) AvailableAddresses(ipReservationID string, r *AvailableRequest) ([]string, *Response, error) { - apiPathQuery := fmt.Sprintf("%s/%s/available?cidr=%d", ipBasePath, ipReservationID, r.CIDR) - ar := new(AvailableResponse) - - resp, err := i.client.DoRequest("GET", apiPathQuery, r, ar) - if err != nil { - return nil, resp, err - } - return ar.Available, resp, nil - -} diff --git a/vendor/github.com/packethost/packngo/metros.go b/vendor/github.com/packethost/packngo/metros.go deleted file mode 100644 index 9de47314..00000000 --- a/vendor/github.com/packethost/packngo/metros.go +++ /dev/null @@ -1,41 +0,0 @@ -package packngo - -const metroBasePath = "/locations/metros" - -// MetroService interface defines available metro methods -type MetroService interface { - List(*ListOptions) ([]Metro, *Response, error) -} - -type metroRoot struct { - Metros []Metro `json:"metros"` -} - -// Metro represents an Equinix Metal metro -type Metro struct { - ID string `json:"id"` - Name string `json:"name,omitempty"` - Code string `json:"code,omitempty"` -} - -func (f Metro) String() string { - return Stringify(f) -} - -// MetroServiceOp implements MetroService -type MetroServiceOp struct { - client *Client -} - -// List returns all metros -func (s *MetroServiceOp) List(opts *ListOptions) ([]Metro, *Response, error) { - root := new(metroRoot) - apiPathQuery := opts.WithQuery(metroBasePath) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, root) - if err != nil { - return nil, resp, err - } - - return root.Metros, resp, err -} diff --git a/vendor/github.com/packethost/packngo/notifications.go b/vendor/github.com/packethost/packngo/notifications.go deleted file mode 100644 index 073484cd..00000000 --- a/vendor/github.com/packethost/packngo/notifications.go +++ /dev/null @@ -1,94 +0,0 @@ -package packngo - -import ( - "path" -) - -const notificationBasePath = "/notifications" - -// Notification struct -type Notification struct { - ID string `json:"id,omitempty"` - Type string `json:"type,omitempty"` - Body string `json:"body,omitempty"` - Severity string `json:"severity,omitempty"` - Read bool `json:"read,omitempty"` - Context string `json:"context,omitempty"` - CreatedAt Timestamp `json:"created_at,omitempty"` - UpdatedAt Timestamp `json:"updated_at,omitempty"` - User Href `json:"user,omitempty"` - Href string `json:"href,omitempty"` -} - -type notificationsRoot struct { - Notifications []Notification `json:"notifications,omitempty"` - Meta meta `json:"meta,omitempty"` -} - -// NotificationService interface defines available event functions -type NotificationService interface { - List(*ListOptions) ([]Notification, *Response, error) - Get(string, *GetOptions) (*Notification, *Response, error) - MarkAsRead(string) (*Notification, *Response, error) -} - -// NotificationServiceOp implements NotificationService -type NotificationServiceOp struct { - client *Client -} - -// List returns all notifications -func (s *NotificationServiceOp) List(listOpt *ListOptions) ([]Notification, *Response, error) { - return listNotifications(s.client, notificationBasePath, listOpt) -} - -// Get returns a notification by ID -func (s *NotificationServiceOp) Get(notificationID string, opts *GetOptions) (*Notification, *Response, error) { - endpointPath := path.Join(notificationBasePath, notificationID) - apiPathQuery := opts.WithQuery(endpointPath) - return getNotifications(s.client, apiPathQuery) -} - -// Marks notification as read by ID -func (s *NotificationServiceOp) MarkAsRead(notificationID string) (*Notification, *Response, error) { - apiPath := path.Join(notificationBasePath, notificationID) - return markAsRead(s.client, apiPath) -} - -// list helper function for all notification functions -func listNotifications(client *Client, endpointPath string, opts *ListOptions) ([]Notification, *Response, error) { - root := new(notificationsRoot) - - apiPathQuery := opts.WithQuery(endpointPath) - - resp, err := client.DoRequest("GET", apiPathQuery, nil, root) - if err != nil { - return nil, resp, err - } - - return root.Notifications, resp, err -} - -func getNotifications(client *Client, apiPath string) (*Notification, *Response, error) { - - notification := new(Notification) - - resp, err := client.DoRequest("GET", apiPath, nil, notification) - if err != nil { - return nil, resp, err - } - - return notification, resp, err -} - -func markAsRead(client *Client, apiPath string) (*Notification, *Response, error) { - - notification := new(Notification) - - resp, err := client.DoRequest("PUT", apiPath, nil, notification) - if err != nil { - return nil, resp, err - } - - return notification, resp, err -} diff --git a/vendor/github.com/packethost/packngo/operatingsystems.go b/vendor/github.com/packethost/packngo/operatingsystems.go deleted file mode 100644 index 087fba6c..00000000 --- a/vendor/github.com/packethost/packngo/operatingsystems.go +++ /dev/null @@ -1,42 +0,0 @@ -package packngo - -const osBasePath = "/operating-systems" - -// OSService interface defines available operating_systems methods -type OSService interface { - List() ([]OS, *Response, error) -} - -type osRoot struct { - OperatingSystems []OS `json:"operating_systems"` -} - -// OS represents an Equinix Metal operating system -type OS struct { - Name string `json:"name"` - Slug string `json:"slug"` - Distro string `json:"distro"` - Version string `json:"version"` - ProvisionableOn []string `json:"provisionable_on"` -} - -func (o OS) String() string { - return Stringify(o) -} - -// OSServiceOp implements OSService -type OSServiceOp struct { - client *Client -} - -// List returns all available operating systems -func (s *OSServiceOp) List() ([]OS, *Response, error) { - root := new(osRoot) - - resp, err := s.client.DoRequest("GET", osBasePath, nil, root) - if err != nil { - return nil, resp, err - } - - return root.OperatingSystems, resp, err -} diff --git a/vendor/github.com/packethost/packngo/organizations.go b/vendor/github.com/packethost/packngo/organizations.go deleted file mode 100644 index 07b0d6bc..00000000 --- a/vendor/github.com/packethost/packngo/organizations.go +++ /dev/null @@ -1,168 +0,0 @@ -package packngo - -import ( - "path" -) - -// API documentation https://metal.equinix.com/developers/api/organizations/ -const organizationBasePath = "/organizations" - -// OrganizationService interface defines available organization methods -type OrganizationService interface { - List(*ListOptions) ([]Organization, *Response, error) - Get(string, *GetOptions) (*Organization, *Response, error) - Create(*OrganizationCreateRequest) (*Organization, *Response, error) - Update(string, *OrganizationUpdateRequest) (*Organization, *Response, error) - Delete(string) (*Response, error) - ListPaymentMethods(string) ([]PaymentMethod, *Response, error) - ListEvents(string, *ListOptions) ([]Event, *Response, error) -} - -type organizationsRoot struct { - Organizations []Organization `json:"organizations"` - Meta meta `json:"meta"` -} - -// Organization represents an Equinix Metal organization -type Organization struct { - ID string `json:"id"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Website string `json:"website,omitempty"` - Twitter string `json:"twitter,omitempty"` - Created string `json:"created_at,omitempty"` - Updated string `json:"updated_at,omitempty"` - Address Address `json:"address,omitempty"` - TaxID string `json:"tax_id,omitempty"` - MainPhone string `json:"main_phone,omitempty"` - BillingPhone string `json:"billing_phone,omitempty"` - CreditAmount float64 `json:"credit_amount,omitempty"` - Logo string `json:"logo,omitempty"` - LogoThumb string `json:"logo_thumb,omitempty"` - Projects []Project `json:"projects,omitempty"` - URL string `json:"href,omitempty"` - Users []User `json:"members,omitempty"` - Owners []User `json:"owners,omitempty"` -} - -func (o Organization) String() string { - return Stringify(o) -} - -// OrganizationCreateRequest type used to create an Equinix Metal organization -type OrganizationCreateRequest struct { - Name string `json:"name"` - Description string `json:"description"` - Website string `json:"website"` - Twitter string `json:"twitter"` - Logo string `json:"logo"` -} - -func (o OrganizationCreateRequest) String() string { - return Stringify(o) -} - -// OrganizationUpdateRequest type used to update an Equinix Metal organization -type OrganizationUpdateRequest struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Website *string `json:"website,omitempty"` - Twitter *string `json:"twitter,omitempty"` - Logo *string `json:"logo,omitempty"` -} - -func (o OrganizationUpdateRequest) String() string { - return Stringify(o) -} - -// OrganizationServiceOp implements OrganizationService -type OrganizationServiceOp struct { - client *Client -} - -// List returns the user's organizations -func (s *OrganizationServiceOp) List(opts *ListOptions) (orgs []Organization, resp *Response, err error) { - subset := new(organizationsRoot) - - apiPathQuery := opts.WithQuery(organizationBasePath) - - for { - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - orgs = append(orgs, subset.Organizations...) - - if apiPathQuery = nextPage(subset.Meta, opts); apiPathQuery != "" { - continue - } - return - } -} - -// Get returns a organization by id -func (s *OrganizationServiceOp) Get(organizationID string, opts *GetOptions) (*Organization, *Response, error) { - endpointPath := path.Join(organizationBasePath, organizationID) - apiPathQuery := opts.WithQuery(endpointPath) - organization := new(Organization) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, organization) - if err != nil { - return nil, resp, err - } - - return organization, resp, err -} - -// Create creates a new organization -func (s *OrganizationServiceOp) Create(createRequest *OrganizationCreateRequest) (*Organization, *Response, error) { - organization := new(Organization) - - resp, err := s.client.DoRequest("POST", organizationBasePath, createRequest, organization) - if err != nil { - return nil, resp, err - } - - return organization, resp, err -} - -// Update updates an organization -func (s *OrganizationServiceOp) Update(id string, updateRequest *OrganizationUpdateRequest) (*Organization, *Response, error) { - apiPath := path.Join(organizationBasePath, id) - organization := new(Organization) - - resp, err := s.client.DoRequest("PATCH", apiPath, updateRequest, organization) - if err != nil { - return nil, resp, err - } - - return organization, resp, err -} - -// Delete deletes an organizationID -func (s *OrganizationServiceOp) Delete(organizationID string) (*Response, error) { - apiPath := path.Join(organizationBasePath, organizationID) - - return s.client.DoRequest("DELETE", apiPath, nil, nil) -} - -// ListPaymentMethods returns PaymentMethods for an organization -func (s *OrganizationServiceOp) ListPaymentMethods(organizationID string) ([]PaymentMethod, *Response, error) { - apiPath := path.Join(organizationBasePath, organizationID, paymentMethodBasePath) - root := new(paymentMethodsRoot) - - resp, err := s.client.DoRequest("GET", apiPath, nil, root) - if err != nil { - return nil, resp, err - } - - return root.PaymentMethods, resp, err -} - -// ListEvents returns list of organization events -func (s *OrganizationServiceOp) ListEvents(organizationID string, listOpt *ListOptions) ([]Event, *Response, error) { - apiPath := path.Join(organizationBasePath, organizationID, eventBasePath) - - return listEvents(s.client, apiPath, listOpt) -} diff --git a/vendor/github.com/packethost/packngo/packngo.go b/vendor/github.com/packethost/packngo/packngo.go deleted file mode 100644 index 68b2c52b..00000000 --- a/vendor/github.com/packethost/packngo/packngo.go +++ /dev/null @@ -1,386 +0,0 @@ -package packngo - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "log" - "net/http" - "net/http/httputil" - "net/url" - "os" - "regexp" - "strconv" - "strings" - "time" -) - -const ( - authTokenEnvVar = "PACKET_AUTH_TOKEN" - baseURL = "https://api.equinix.com/metal/v1/" - mediaType = "application/json" - debugEnvVar = "PACKNGO_DEBUG" - - headerRateLimit = "X-RateLimit-Limit" - headerRateRemaining = "X-RateLimit-Remaining" - headerRateReset = "X-RateLimit-Reset" - expectedAPIContentTypePrefix = "application/json" - - // UserAgent is the default HTTP User-Agent Header value that will be used by NewClient - UserAgent = "packngo/" + Version -) - -// meta contains pagination information -type meta struct { - Self *Href `json:"self"` - First *Href `json:"first"` - Last *Href `json:"last"` - Previous *Href `json:"previous,omitempty"` - Next *Href `json:"next,omitempty"` - Total int `json:"total"` - CurrentPageNum int `json:"current_page"` - LastPageNum int `json:"last_page"` -} - -// Response is the http response from api calls -type Response struct { - *http.Response - Rate -} - -// Href is an API link -type Href struct { - Href string `json:"href"` -} - -func (r *Response) populateRate() { - // parse the rate limit headers and populate Response.Rate - if limit := r.Header.Get(headerRateLimit); limit != "" { - r.Rate.RequestLimit, _ = strconv.Atoi(limit) - } - if remaining := r.Header.Get(headerRateRemaining); remaining != "" { - r.Rate.RequestsRemaining, _ = strconv.Atoi(remaining) - } - if reset := r.Header.Get(headerRateReset); reset != "" { - if v, _ := strconv.ParseInt(reset, 10, 64); v != 0 { - r.Rate.Reset = Timestamp{time.Unix(v, 0)} - } - } -} - -// ErrorResponse is the http response used on errors -type ErrorResponse struct { - Response *http.Response - Errors []string `json:"errors"` - SingleError string `json:"error"` -} - -func (r *ErrorResponse) Error() string { - return fmt.Sprintf("%v %v: %d %v %v", - r.Response.Request.Method, r.Response.Request.URL, r.Response.StatusCode, strings.Join(r.Errors, ", "), r.SingleError) -} - -// Client is the base API Client -type Client struct { - client *http.Client - debug bool - - BaseURL *url.URL - - UserAgent string - ConsumerToken string - APIKey string - - RateLimit Rate - - // Equinix Metal Api Objects - APIKeys APIKeyService - BGPConfig BGPConfigService - BGPSessions BGPSessionService - Batches BatchService - CapacityService CapacityService - Connections ConnectionService - DeviceIPs DeviceIPService - Devices DeviceService - Emails EmailService - Events EventService - Facilities FacilityService - HardwareReservations HardwareReservationService - Metros MetroService - Notifications NotificationService - OperatingSystems OSService - Organizations OrganizationService - Plans PlanService - Ports PortService - ProjectIPs ProjectIPService - ProjectVirtualNetworks ProjectVirtualNetworkService - Projects ProjectService - SSHKeys SSHKeyService - SpotMarket SpotMarketService - SpotMarketRequests SpotMarketRequestService - TwoFactorAuth TwoFactorAuthService - Users UserService - VirtualCircuits VirtualCircuitService - VolumeAttachments VolumeAttachmentService - Volumes VolumeService - - // DevicePorts - // - // Deprecated: Use Client.Ports or Device methods - DevicePorts DevicePortService - - // VPN - // - // Deprecated: As of March 31, 2021, Doorman service is no longer - // available. See https://metal.equinix.com/developers/docs/accounts/doorman/ - // for more details. - VPN VPNService -} - -// requestDoer provides methods for making HTTP requests and receiving the -// response, errors, and a structured result -// -// This interface is used in *ServiceOp as a mockable alternative to a full -// Client object. -type requestDoer interface { - NewRequest(method, path string, body interface{}) (*http.Request, error) - Do(req *http.Request, v interface{}) (*Response, error) - DoRequest(method, path string, body, v interface{}) (*Response, error) - DoRequestWithHeader(method string, headers map[string]string, path string, body, v interface{}) (*Response, error) -} - -// NewRequest inits a new http request with the proper headers -func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error) { - // relative path to append to the endpoint url, no leading slash please - if path[0] == '/' { - path = path[1:] - } - rel, err := url.Parse(path) - if err != nil { - return nil, err - } - - u := c.BaseURL.ResolveReference(rel) - - // json encode the request body, if any - buf := new(bytes.Buffer) - if body != nil { - err := json.NewEncoder(buf).Encode(body) - if err != nil { - return nil, err - } - } - - req, err := http.NewRequest(method, u.String(), buf) - if err != nil { - return nil, err - } - - req.Close = true - - req.Header.Add("X-Auth-Token", c.APIKey) - req.Header.Add("X-Consumer-Token", c.ConsumerToken) - - req.Header.Add("Content-Type", mediaType) - req.Header.Add("Accept", mediaType) - req.Header.Add("User-Agent", c.UserAgent) - return req, nil -} - -// Do executes the http request -func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) { - resp, err := c.client.Do(req) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - response := Response{Response: resp} - response.populateRate() - if c.debug { - dumpResponse(response.Response) - } - c.RateLimit = response.Rate - - err = checkResponse(resp) - // if the response is an error, return the ErrorResponse - if err != nil { - return &response, err - } - - if v != nil { - // if v implements the io.Writer interface, return the raw response - if w, ok := v.(io.Writer); ok { - _, err = io.Copy(w, resp.Body) - if err != nil { - return &response, err - } - } else { - err = json.NewDecoder(resp.Body).Decode(v) - if err != nil { - return &response, err - } - } - } - - return &response, err -} - -func dumpResponse(resp *http.Response) { - o, _ := httputil.DumpResponse(resp, true) - strResp := string(o) - reg, _ := regexp.Compile(`"token":(.+?),`) - reMatches := reg.FindStringSubmatch(strResp) - if len(reMatches) == 2 { - strResp = strings.Replace(strResp, reMatches[1], strings.Repeat("-", len(reMatches[1])), 1) - } - log.Printf("\n=======[RESPONSE]============\n%s\n\n", strResp) -} - -func dumpRequest(req *http.Request) { - r := req.Clone(context.TODO()) - r.Body, _ = req.GetBody() - h := r.Header - if len(h.Get("X-Auth-Token")) != 0 { - h.Set("X-Auth-Token", "**REDACTED**") - } - defer r.Body.Close() - - o, _ := httputil.DumpRequestOut(r, false) - bbs, _ := ioutil.ReadAll(r.Body) - - strReq := string(o) - log.Printf("\n=======[REQUEST]=============\n%s%s\n", string(strReq), string(bbs)) -} - -// DoRequest is a convenience method, it calls NewRequest followed by Do -// v is the interface to unmarshal the response JSON into -func (c *Client) DoRequest(method, path string, body, v interface{}) (*Response, error) { - req, err := c.NewRequest(method, path, body) - if c.debug { - dumpRequest(req) - } - if err != nil { - return nil, err - } - return c.Do(req, v) -} - -// DoRequestWithHeader same as DoRequest -func (c *Client) DoRequestWithHeader(method string, headers map[string]string, path string, body, v interface{}) (*Response, error) { - req, err := c.NewRequest(method, path, body) - for k, v := range headers { - req.Header.Add(k, v) - } - - if c.debug { - dumpRequest(req) - } - if err != nil { - return nil, err - } - return c.Do(req, v) -} - -// NewClient initializes and returns a Client -func NewClient() (*Client, error) { - apiToken := os.Getenv(authTokenEnvVar) - if apiToken == "" { - return nil, fmt.Errorf("you must export %s", authTokenEnvVar) - } - c := NewClientWithAuth("packngo lib", apiToken, nil) - return c, nil - -} - -// NewClientWithAuth initializes and returns a Client, use this to get an API Client to operate on -// N.B.: Equinix Metal's API certificate requires Go 1.5+ to successfully parse. If you are using -// an older version of Go, pass in a custom http.Client with a custom TLS configuration -// that sets "InsecureSkipVerify" to "true" -func NewClientWithAuth(consumerToken string, apiKey string, httpClient *http.Client) *Client { - client, _ := NewClientWithBaseURL(consumerToken, apiKey, httpClient, baseURL) - return client -} - -// NewClientWithBaseURL returns a Client pointing to nonstandard API URL, e.g. -// for mocking the remote API -func NewClientWithBaseURL(consumerToken string, apiKey string, httpClient *http.Client, apiBaseURL string) (*Client, error) { - if httpClient == nil { - httpClient = http.DefaultClient - } - - u, err := url.Parse(apiBaseURL) - if err != nil { - return nil, err - } - - c := &Client{client: httpClient, BaseURL: u, UserAgent: UserAgent, ConsumerToken: consumerToken, APIKey: apiKey} - c.APIKeys = &APIKeyServiceOp{client: c} - c.BGPConfig = &BGPConfigServiceOp{client: c} - c.BGPSessions = &BGPSessionServiceOp{client: c} - c.Batches = &BatchServiceOp{client: c} - c.CapacityService = &CapacityServiceOp{client: c} - c.Connections = &ConnectionServiceOp{client: c} - c.DeviceIPs = &DeviceIPServiceOp{client: c} - c.DevicePorts = &DevicePortServiceOp{client: c} - c.Devices = &DeviceServiceOp{client: c} - c.Emails = &EmailServiceOp{client: c} - c.Events = &EventServiceOp{client: c} - c.Facilities = &FacilityServiceOp{client: c} - c.HardwareReservations = &HardwareReservationServiceOp{client: c} - c.Metros = &MetroServiceOp{client: c} - c.Notifications = &NotificationServiceOp{client: c} - c.OperatingSystems = &OSServiceOp{client: c} - c.Organizations = &OrganizationServiceOp{client: c} - c.Plans = &PlanServiceOp{client: c} - c.Ports = &PortServiceOp{client: c} - c.ProjectIPs = &ProjectIPServiceOp{client: c} - c.ProjectVirtualNetworks = &ProjectVirtualNetworkServiceOp{client: c} - c.Projects = &ProjectServiceOp{client: c} - c.SSHKeys = &SSHKeyServiceOp{client: c} - c.SpotMarket = &SpotMarketServiceOp{client: c} - c.SpotMarketRequests = &SpotMarketRequestServiceOp{client: c} - c.TwoFactorAuth = &TwoFactorAuthServiceOp{client: c} - c.Users = &UserServiceOp{client: c} - c.VirtualCircuits = &VirtualCircuitServiceOp{client: c} - c.VPN = &VPNServiceOp{client: c} - c.VolumeAttachments = &VolumeAttachmentServiceOp{client: c} - c.Volumes = &VolumeServiceOp{client: c} - c.debug = os.Getenv(debugEnvVar) != "" - - return c, nil -} - -func checkResponse(r *http.Response) error { - - if s := r.StatusCode; s >= 200 && s <= 299 { - // response is good, return - return nil - } - - errorResponse := &ErrorResponse{Response: r} - data, err := ioutil.ReadAll(r.Body) - // if the response has a body, populate the message in errorResponse - if err != nil { - return err - } - - ct := r.Header.Get("Content-Type") - if !strings.HasPrefix(ct, expectedAPIContentTypePrefix) { - errorResponse.SingleError = fmt.Sprintf("Unexpected Content-Type %s with status %s", ct, r.Status) - return errorResponse - } - - if len(data) > 0 { - err = json.Unmarshal(data, errorResponse) - if err != nil { - return err - } - } - - return errorResponse -} diff --git a/vendor/github.com/packethost/packngo/payment_methods.go b/vendor/github.com/packethost/packngo/payment_methods.go deleted file mode 100644 index 8f9840f0..00000000 --- a/vendor/github.com/packethost/packngo/payment_methods.go +++ /dev/null @@ -1,71 +0,0 @@ -package packngo - -// API documentation https://metal.equinix.com/developers/api/paymentmethods/ -const paymentMethodBasePath = "/payment-methods" - -// ProjectService interface defines available project methods -type PaymentMethodService interface { - List() ([]PaymentMethod, *Response, error) - Get(string) (*PaymentMethod, *Response, error) - Create(*PaymentMethodCreateRequest) (*PaymentMethod, *Response, error) - Update(string, *PaymentMethodUpdateRequest) (*PaymentMethod, *Response, error) - Delete(string) (*Response, error) -} - -type paymentMethodsRoot struct { - PaymentMethods []PaymentMethod `json:"payment_methods"` -} - -// PaymentMethod represents an Equinix Metal payment method of an organization -type PaymentMethod struct { - ID string `json:"id"` - Name string `json:"name,omitempty"` - Created string `json:"created_at,omitempty"` - Updated string `json:"updated_at,omitempty"` - Nonce string `json:"nonce,omitempty"` - Default bool `json:"default,omitempty"` - Organization Organization `json:"organization,omitempty"` - Projects []Project `json:"projects,omitempty"` - Type string `json:"type,omitempty"` - CardholderName string `json:"cardholder_name,omitempty"` - ExpMonth string `json:"expiration_month,omitempty"` - ExpYear string `json:"expiration_year,omitempty"` - Last4 string `json:"last_4,omitempty"` - BillingAddress BillingAddress `json:"billing_address,omitempty"` - URL string `json:"href,omitempty"` -} - -func (pm PaymentMethod) String() string { - return Stringify(pm) -} - -// PaymentMethodCreateRequest type used to create an Equinix Metal payment method of an organization -type PaymentMethodCreateRequest struct { - Name string `json:"name"` - Nonce string `json:"nonce"` - CardholderName string `json:"cardholder_name,omitempty"` - ExpMonth string `json:"expiration_month,omitempty"` - ExpYear string `json:"expiration_year,omitempty"` - BillingAddress string `json:"billing_address,omitempty"` -} - -func (pm PaymentMethodCreateRequest) String() string { - return Stringify(pm) -} - -// PaymentMethodUpdateRequest type used to update an Equinix Metal payment method of an organization -type PaymentMethodUpdateRequest struct { - Name *string `json:"name,omitempty"` - CardholderName *string `json:"cardholder_name,omitempty"` - ExpMonth *string `json:"expiration_month,omitempty"` - ExpYear *string `json:"expiration_year,omitempty"` - BillingAddress *string `json:"billing_address,omitempty"` -} - -func (pm PaymentMethodUpdateRequest) String() string { - return Stringify(pm) -} - -// PaymentMethodServiceOp implements PaymentMethodService -type PaymentMethodServiceOp struct { -} diff --git a/vendor/github.com/packethost/packngo/plans.go b/vendor/github.com/packethost/packngo/plans.go deleted file mode 100644 index 483f18ed..00000000 --- a/vendor/github.com/packethost/packngo/plans.go +++ /dev/null @@ -1,143 +0,0 @@ -package packngo - -import "path" - -const planBasePath = "/plans" - -// PlanService interface defines available plan methods -type PlanService interface { - List(*ListOptions) ([]Plan, *Response, error) - ProjectList(string, *ListOptions) ([]Plan, *Response, error) - OrganizationList(string, *ListOptions) ([]Plan, *Response, error) -} - -type planRoot struct { - Plans []Plan `json:"plans"` -} - -// Plan represents an Equinix Metal service plan -type Plan struct { - ID string `json:"id"` - Slug string `json:"slug,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Line string `json:"line,omitempty"` - Legacy bool `json:"legacy,omitempty"` - Specs *Specs `json:"specs,omitempty"` - Pricing *Pricing `json:"pricing,omitempty"` - DeploymentTypes []string `json:"deployment_types"` - Class string `json:"class"` - AvailableIn []Facility `json:"available_in"` - AvailableInMetros []Metro `json:"available_in_metros"` -} - -func (p Plan) String() string { - return Stringify(p) -} - -// Specs - the server specs for a plan -type Specs struct { - Cpus []*Cpus `json:"cpus,omitempty"` - Memory *Memory `json:"memory,omitempty"` - Drives []*Drives `json:"drives,omitempty"` - Nics []*Nics `json:"nics,omitempty"` - Features *Features `json:"features,omitempty"` -} - -func (s Specs) String() string { - return Stringify(s) -} - -// Cpus - the CPU config details for specs on a plan -type Cpus struct { - Count int `json:"count,omitempty"` - Type string `json:"type,omitempty"` -} - -func (c Cpus) String() string { - return Stringify(c) -} - -// Memory - the RAM config details for specs on a plan -type Memory struct { - Total string `json:"total,omitempty"` -} - -func (m Memory) String() string { - return Stringify(m) -} - -// Drives - the storage config details for specs on a plan -type Drives struct { - Count int `json:"count,omitempty"` - Size string `json:"size,omitempty"` - Type string `json:"type,omitempty"` -} - -func (d Drives) String() string { - return Stringify(d) -} - -// Nics - the network hardware details for specs on a plan -type Nics struct { - Count int `json:"count,omitempty"` - Type string `json:"type,omitempty"` -} - -func (n Nics) String() string { - return Stringify(n) -} - -// Features - other features in the specs for a plan -type Features struct { - Raid bool `json:"raid,omitempty"` - Txt bool `json:"txt,omitempty"` -} - -func (f Features) String() string { - return Stringify(f) -} - -// Pricing - the pricing options on a plan -type Pricing struct { - Hour float32 `json:"hour,omitempty"` - Month float32 `json:"month,omitempty"` -} - -func (p Pricing) String() string { - return Stringify(p) -} - -// PlanServiceOp implements PlanService -type PlanServiceOp struct { - client *Client -} - -func planList(c *Client, apiPath string, opts *ListOptions) ([]Plan, *Response, error) { - root := new(planRoot) - apiPathQuery := opts.WithQuery(apiPath) - - resp, err := c.DoRequest("GET", apiPathQuery, nil, root) - if err != nil { - return nil, resp, err - } - - return root.Plans, resp, err - -} - -// List method returns all available plans -func (s *PlanServiceOp) List(opts *ListOptions) ([]Plan, *Response, error) { - return planList(s.client, planBasePath, opts) - -} - -// ProjectList method returns plans available in a project -func (s *PlanServiceOp) ProjectList(projectID string, opts *ListOptions) ([]Plan, *Response, error) { - return planList(s.client, path.Join(projectBasePath, projectID, planBasePath), opts) -} - -// OrganizationList method returns plans available in an organization -func (s *PlanServiceOp) OrganizationList(organizationID string, opts *ListOptions) ([]Plan, *Response, error) { - return planList(s.client, path.Join(organizationBasePath, organizationID, planBasePath), opts) -} diff --git a/vendor/github.com/packethost/packngo/ports.go b/vendor/github.com/packethost/packngo/ports.go deleted file mode 100644 index d820e722..00000000 --- a/vendor/github.com/packethost/packngo/ports.go +++ /dev/null @@ -1,208 +0,0 @@ -package packngo - -import ( - "path" -) - -// PortService handles operations on a port -type PortService interface { - Assign(string, string) (*Port, *Response, error) - Unassign(string, string) (*Port, *Response, error) - AssignNative(string, string) (*Port, *Response, error) - UnassignNative(string) (*Port, *Response, error) - Bond(string, bool) (*Port, *Response, error) - Disbond(string, bool) (*Port, *Response, error) - ConvertToLayerTwo(string) (*Port, *Response, error) - ConvertToLayerThree(string, []AddressRequest) (*Port, *Response, error) - Get(string, *GetOptions) (*Port, *Response, error) -} - -type PortServiceOp struct { - client requestDoer -} - -var _ PortService = (*PortServiceOp)(nil) - -type PortData struct { - // MAC address is set for NetworkPort ports - MAC string `json:"mac,omitempty"` - - // Bonded is true for NetworkPort ports in a bond and NetworkBondPort ports - // that are active - Bonded bool `json:"bonded"` -} - -type BondData struct { - // ID is the Port.ID of the bonding port - ID string `json:"id"` - - // Name of the port interface for the bond ("bond0") - Name string `json:"name"` -} - -// Port is a hardware port associated with a reserved or instantiated hardware -// device. -type Port struct { - // ID of the Port - ID string `json:"id"` - - // Type is either "NetworkBondPort" for bond ports or "NetworkPort" for - // bondable ethernet ports - Type string `json:"type"` - - // Name of the interface for this port (such as "bond0" or "eth0") - Name string `json:"name"` - - // Data about the port - Data PortData `json:"data,omitempty"` - - // Indicates whether or not the bond can be broken on the port (when applicable). - DisbondOperationSupported bool `json:"disbond_operation_supported,omitempty"` - - // NetworkType is either of layer2-bonded, layer2-individual, layer3, - // hybrid, hybrid-bonded - NetworkType string `json:"network_type,omitempty"` - - // NativeVirtualNetwork is the Native VLAN attached to the port - // - NativeVirtualNetwork *VirtualNetwork `json:"native_virtual_network,omitempty"` - - // VLANs attached to the port - AttachedVirtualNetworks []VirtualNetwork `json:"virtual_networks,omitempty"` - - // Bond details for ports with a NetworkPort type - Bond *BondData `json:"bond,omitempty"` -} - -type AddressRequest struct { - AddressFamily int `json:"address_family"` - Public bool `json:"public"` -} - -type BackToL3Request struct { - RequestIPs []AddressRequest `json:"request_ips"` -} - -type PortAssignRequest struct { - // PortID of the Port - // - // Deprecated: this is redundant to the portID parameter in request - // functions. This is kept for use by deprecated DevicePortServiceOps - // methods. - PortID string `json:"id,omitempty"` - - VirtualNetworkID string `json:"vnid"` -} - -type BondRequest struct { - BulkEnable bool `json:"bulk_enable"` -} - -type DisbondRequest struct { - BulkDisable bool `json:"bulk_disable"` -} - -// Assign adds a VLAN to a port -func (i *PortServiceOp) Assign(portID, vlanID string) (*Port, *Response, error) { - apiPath := path.Join(portBasePath, portID, "assign") - par := &PortAssignRequest{VirtualNetworkID: vlanID} - - return i.portAction(apiPath, par) -} - -// AssignNative assigns a virtual network to the port as a "native VLAN" -func (i *PortServiceOp) AssignNative(portID, vlanID string) (*Port, *Response, error) { - apiPath := path.Join(portBasePath, portID, "native-vlan") - par := &PortAssignRequest{VirtualNetworkID: vlanID} - return i.portAction(apiPath, par) -} - -// UnassignNative removes native VLAN from the supplied port -func (i *PortServiceOp) UnassignNative(portID string) (*Port, *Response, error) { - apiPath := path.Join(portBasePath, portID, "native-vlan") - port := new(Port) - - resp, err := i.client.DoRequest("DELETE", apiPath, nil, port) - if err != nil { - return nil, resp, err - } - - return port, resp, err -} - -// Unassign removes a VLAN from the port -func (i *PortServiceOp) Unassign(portID, vlanID string) (*Port, *Response, error) { - apiPath := path.Join(portBasePath, portID, "unassign") - par := &PortAssignRequest{VirtualNetworkID: vlanID} - - return i.portAction(apiPath, par) -} - -// Bond enables bonding for one or all ports -func (i *PortServiceOp) Bond(portID string, bulkEnable bool) (*Port, *Response, error) { - br := &BondRequest{BulkEnable: bulkEnable} - apiPath := path.Join(portBasePath, portID, "bond") - return i.portAction(apiPath, br) -} - -// Disbond disables bonding for one or all ports -func (i *PortServiceOp) Disbond(portID string, bulkEnable bool) (*Port, *Response, error) { - dr := &DisbondRequest{BulkDisable: bulkEnable} - apiPath := path.Join(portBasePath, portID, "disbond") - return i.portAction(apiPath, dr) -} - -func (i *PortServiceOp) portAction(apiPath string, req interface{}) (*Port, *Response, error) { - port := new(Port) - - resp, err := i.client.DoRequest("POST", apiPath, req, port) - if err != nil { - return nil, resp, err - } - - return port, resp, err -} - -// ConvertToLayerTwo converts a bond port to Layer 2. IP assignments of the port will be removed. -// -// portID is the UUID of a Bonding Port -func (i *PortServiceOp) ConvertToLayerTwo(portID string) (*Port, *Response, error) { - apiPath := path.Join(portBasePath, portID, "convert", "layer-2") - port := new(Port) - - resp, err := i.client.DoRequest("POST", apiPath, nil, port) - if err != nil { - return nil, resp, err - } - - return port, resp, err -} - -// ConvertToLayerThree converts a bond port to Layer 3. VLANs must first be unassigned. -func (i *PortServiceOp) ConvertToLayerThree(portID string, ips []AddressRequest) (*Port, *Response, error) { - apiPath := path.Join(portBasePath, portID, "convert", "layer-3") - port := new(Port) - - req := BackToL3Request{ - RequestIPs: ips, - } - - resp, err := i.client.DoRequest("POST", apiPath, &req, port) - if err != nil { - return nil, resp, err - } - - return port, resp, err -} - -// Get returns a port by id -func (s *PortServiceOp) Get(portID string, opts *GetOptions) (*Port, *Response, error) { - endpointPath := path.Join(portBasePath, portID) - apiPathQuery := opts.WithQuery(endpointPath) - port := new(Port) - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, port) - if err != nil { - return nil, resp, err - } - return port, resp, err -} diff --git a/vendor/github.com/packethost/packngo/projects.go b/vendor/github.com/packethost/packngo/projects.go deleted file mode 100644 index 24f56c6e..00000000 --- a/vendor/github.com/packethost/packngo/projects.go +++ /dev/null @@ -1,182 +0,0 @@ -package packngo - -import ( - "path" -) - -const projectBasePath = "/projects" - -// ProjectService interface defines available project methods -type ProjectService interface { - List(listOpt *ListOptions) ([]Project, *Response, error) - Get(string, *GetOptions) (*Project, *Response, error) - Create(*ProjectCreateRequest) (*Project, *Response, error) - Update(string, *ProjectUpdateRequest) (*Project, *Response, error) - Delete(string) (*Response, error) - ListBGPSessions(projectID string, listOpt *ListOptions) ([]BGPSession, *Response, error) - ListEvents(string, *ListOptions) ([]Event, *Response, error) - ListSSHKeys(projectID string, searchOpt *SearchOptions) ([]SSHKey, *Response, error) -} - -type projectsRoot struct { - Projects []Project `json:"projects"` - Meta meta `json:"meta"` -} - -// Project represents an Equinix Metal project -type Project struct { - ID string `json:"id"` - Name string `json:"name,omitempty"` - Organization Organization `json:"organization,omitempty"` - Created string `json:"created_at,omitempty"` - Updated string `json:"updated_at,omitempty"` - Users []User `json:"members,omitempty"` - Devices []Device `json:"devices,omitempty"` - SSHKeys []SSHKey `json:"ssh_keys,omitempty"` - URL string `json:"href,omitempty"` - PaymentMethod PaymentMethod `json:"payment_method,omitempty"` - BackendTransfer bool `json:"backend_transfer_enabled"` -} - -func (p Project) String() string { - return Stringify(p) -} - -// ProjectCreateRequest type used to create an Equinix Metal project -type ProjectCreateRequest struct { - Name string `json:"name"` - PaymentMethodID string `json:"payment_method_id,omitempty"` - OrganizationID string `json:"organization_id,omitempty"` -} - -func (p ProjectCreateRequest) String() string { - return Stringify(p) -} - -// ProjectUpdateRequest type used to update an Equinix Metal project -type ProjectUpdateRequest struct { - Name *string `json:"name,omitempty"` - PaymentMethodID *string `json:"payment_method_id,omitempty"` - BackendTransfer *bool `json:"backend_transfer_enabled,omitempty"` -} - -func (p ProjectUpdateRequest) String() string { - return Stringify(p) -} - -// ProjectServiceOp implements ProjectService -type ProjectServiceOp struct { - client requestDoer -} - -// List returns the user's projects -func (s *ProjectServiceOp) List(opts *ListOptions) (projects []Project, resp *Response, err error) { - apiPathQuery := opts.WithQuery(projectBasePath) - - for { - subset := new(projectsRoot) - - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - projects = append(projects, subset.Projects...) - - if apiPathQuery = nextPage(subset.Meta, opts); apiPathQuery != "" { - continue - } - - return - } -} - -// Get returns a project by id -func (s *ProjectServiceOp) Get(projectID string, opts *GetOptions) (*Project, *Response, error) { - endpointPath := path.Join(projectBasePath, projectID) - apiPathQuery := opts.WithQuery(endpointPath) - project := new(Project) - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, project) - if err != nil { - return nil, resp, err - } - return project, resp, err -} - -// Create creates a new project -func (s *ProjectServiceOp) Create(createRequest *ProjectCreateRequest) (*Project, *Response, error) { - project := new(Project) - - resp, err := s.client.DoRequest("POST", projectBasePath, createRequest, project) - if err != nil { - return nil, resp, err - } - - return project, resp, err -} - -// Update updates a project -func (s *ProjectServiceOp) Update(id string, updateRequest *ProjectUpdateRequest) (*Project, *Response, error) { - apiPath := path.Join(projectBasePath, id) - project := new(Project) - - resp, err := s.client.DoRequest("PATCH", apiPath, updateRequest, project) - if err != nil { - return nil, resp, err - } - - return project, resp, err -} - -// Delete deletes a project -func (s *ProjectServiceOp) Delete(projectID string) (*Response, error) { - apiPath := path.Join(projectBasePath, projectID) - - return s.client.DoRequest("DELETE", apiPath, nil, nil) -} - -// ListBGPSessions returns all BGP Sessions associated with the project -func (s *ProjectServiceOp) ListBGPSessions(projectID string, opts *ListOptions) (bgpSessions []BGPSession, resp *Response, err error) { - endpointPath := path.Join(projectBasePath, projectID, bgpSessionBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - - for { - subset := new(bgpSessionsRoot) - - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - bgpSessions = append(bgpSessions, subset.Sessions...) - if apiPathQuery = nextPage(subset.Meta, opts); apiPathQuery != "" { - continue - } - return - } -} - -// ListSSHKeys returns all SSH Keys associated with the project -func (s *ProjectServiceOp) ListSSHKeys(projectID string, opts *SearchOptions) (sshKeys []SSHKey, resp *Response, err error) { - - endpointPath := path.Join(projectBasePath, projectID, sshKeyBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - - subset := new(sshKeyRoot) - - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - sshKeys = append(sshKeys, subset.SSHKeys...) - - return -} - -// ListEvents returns list of project events -func (s *ProjectServiceOp) ListEvents(projectID string, listOpt *ListOptions) ([]Event, *Response, error) { - apiPath := path.Join(projectBasePath, projectID, eventBasePath) - - return listEvents(s.client, apiPath, listOpt) -} diff --git a/vendor/github.com/packethost/packngo/rate.go b/vendor/github.com/packethost/packngo/rate.go deleted file mode 100644 index 965967d4..00000000 --- a/vendor/github.com/packethost/packngo/rate.go +++ /dev/null @@ -1,12 +0,0 @@ -package packngo - -// Rate provides the API request rate limit details -type Rate struct { - RequestLimit int `json:"request_limit"` - RequestsRemaining int `json:"requests_remaining"` - Reset Timestamp `json:"rate_reset"` -} - -func (r Rate) String() string { - return Stringify(r) -} diff --git a/vendor/github.com/packethost/packngo/spotmarket.go b/vendor/github.com/packethost/packngo/spotmarket.go deleted file mode 100644 index 5dfb7d55..00000000 --- a/vendor/github.com/packethost/packngo/spotmarket.go +++ /dev/null @@ -1,39 +0,0 @@ -package packngo - -const spotMarketBasePath = "/market/spot/prices" - -// SpotMarketService expooses Spot Market methods -type SpotMarketService interface { - Prices() (PriceMap, *Response, error) -} - -// SpotMarketServiceOp implements SpotMarketService -type SpotMarketServiceOp struct { - client *Client -} - -// PriceMap is a map of [facility][plan]-> float Price -type PriceMap map[string]map[string]float64 - -// Prices gets current PriceMap from the API -func (s *SpotMarketServiceOp) Prices() (PriceMap, *Response, error) { - root := new(struct { - SMPs map[string]map[string]struct { - Price float64 `json:"price"` - } `json:"spot_market_prices"` - }) - - resp, err := s.client.DoRequest("GET", spotMarketBasePath, nil, root) - if err != nil { - return nil, resp, err - } - - prices := make(PriceMap) - for facility, planMap := range root.SMPs { - prices[facility] = map[string]float64{} - for plan, v := range planMap { - prices[facility][plan] = v.Price - } - } - return prices, resp, err -} diff --git a/vendor/github.com/packethost/packngo/spotmarketrequest.go b/vendor/github.com/packethost/packngo/spotmarketrequest.go deleted file mode 100644 index 05fe1122..00000000 --- a/vendor/github.com/packethost/packngo/spotmarketrequest.go +++ /dev/null @@ -1,118 +0,0 @@ -package packngo - -import ( - "math" - "path" -) - -const spotMarketRequestBasePath = "/spot-market-requests" - -type SpotMarketRequestService interface { - List(string, *ListOptions) ([]SpotMarketRequest, *Response, error) - Create(*SpotMarketRequestCreateRequest, string) (*SpotMarketRequest, *Response, error) - Delete(string, bool) (*Response, error) - Get(string, *GetOptions) (*SpotMarketRequest, *Response, error) -} - -type SpotMarketRequestCreateRequest struct { - DevicesMax int `json:"devices_max"` - DevicesMin int `json:"devices_min"` - EndAt *Timestamp `json:"end_at,omitempty"` - FacilityIDs []string `json:"facilities"` - MaxBidPrice float64 `json:"max_bid_price"` - - Parameters SpotMarketRequestInstanceParameters `json:"instance_parameters"` -} - -type SpotMarketRequest struct { - SpotMarketRequestCreateRequest - ID string `json:"id"` - Devices []Device `json:"devices"` - Facilities []Facility `json:"facilities"` - Project Project `json:"project"` - Href string `json:"href"` - Plan Plan `json:"plan"` -} - -type SpotMarketRequestInstanceParameters struct { - AlwaysPXE bool `json:"always_pxe,omitempty"` - IPXEScriptURL string `json:"ipxe_script_url,omitempty"` - BillingCycle string `json:"billing_cycle"` - CustomData string `json:"customdata,omitempty"` - Description string `json:"description,omitempty"` - Features []string `json:"features,omitempty"` - Hostname string `json:"hostname,omitempty"` - Hostnames []string `json:"hostnames,omitempty"` - Locked bool `json:"locked,omitempty"` - OperatingSystem string `json:"operating_system"` - Plan string `json:"plan"` - ProjectSSHKeys []string `json:"project_ssh_keys,omitempty"` - Tags []string `json:"tags"` - TerminationTime *Timestamp `json:"termination_time,omitempty"` - UserSSHKeys []string `json:"user_ssh_keys,omitempty"` - UserData string `json:"userdata"` -} - -type SpotMarketRequestServiceOp struct { - client *Client -} - -func roundPlus(f float64, places int) float64 { - shift := math.Pow(10, float64(places)) - return math.Floor(f*shift+.5) / shift -} - -func (s *SpotMarketRequestServiceOp) Create(cr *SpotMarketRequestCreateRequest, pID string) (*SpotMarketRequest, *Response, error) { - opts := (&GetOptions{}).Including("devices", "project", "plan") - endpointPath := path.Join(projectBasePath, pID, spotMarketRequestBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - - cr.MaxBidPrice = roundPlus(cr.MaxBidPrice, 2) - smr := new(SpotMarketRequest) - - resp, err := s.client.DoRequest("POST", apiPathQuery, cr, smr) - if err != nil { - return nil, resp, err - } - - return smr, resp, err -} - -func (s *SpotMarketRequestServiceOp) List(pID string, opts *ListOptions) ([]SpotMarketRequest, *Response, error) { - type smrRoot struct { - SMRs []SpotMarketRequest `json:"spot_market_requests"` - } - - endpointPath := path.Join(projectBasePath, pID, spotMarketRequestBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - output := new(smrRoot) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, output) - if err != nil { - return nil, nil, err - } - - return output.SMRs, resp, nil -} - -func (s *SpotMarketRequestServiceOp) Get(id string, opts *GetOptions) (*SpotMarketRequest, *Response, error) { - endpointPath := path.Join(spotMarketRequestBasePath, id) - apiPathQuery := opts.WithQuery(endpointPath) - smr := new(SpotMarketRequest) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, &smr) - if err != nil { - return nil, resp, err - } - - return smr, resp, err -} - -func (s *SpotMarketRequestServiceOp) Delete(id string, forceDelete bool) (*Response, error) { - apiPath := path.Join(spotMarketRequestBasePath, id) - var params *map[string]bool - if forceDelete { - params = &map[string]bool{"force_termination": true} - } - return s.client.DoRequest("DELETE", apiPath, params, nil) -} diff --git a/vendor/github.com/packethost/packngo/sshkeys.go b/vendor/github.com/packethost/packngo/sshkeys.go deleted file mode 100644 index 3f4e3b74..00000000 --- a/vendor/github.com/packethost/packngo/sshkeys.go +++ /dev/null @@ -1,143 +0,0 @@ -package packngo - -import ( - "fmt" - "path" -) - -const ( - sshKeyBasePath = "/ssh-keys" -) - -// SSHKeyService interface defines available device methods -type SSHKeyService interface { - List() ([]SSHKey, *Response, error) - ProjectList(string) ([]SSHKey, *Response, error) - Get(string, *GetOptions) (*SSHKey, *Response, error) - Create(*SSHKeyCreateRequest) (*SSHKey, *Response, error) - Update(string, *SSHKeyUpdateRequest) (*SSHKey, *Response, error) - Delete(string) (*Response, error) -} - -type sshKeyRoot struct { - SSHKeys []SSHKey `json:"ssh_keys"` -} - -// SSHKey represents a user's ssh key -type SSHKey struct { - ID string `json:"id"` - Label string `json:"label"` - Key string `json:"key"` - FingerPrint string `json:"fingerprint"` - Created string `json:"created_at"` - Updated string `json:"updated_at"` - Owner Href - URL string `json:"href,omitempty"` -} - -func (s SSHKey) String() string { - return Stringify(s) -} - -// SSHKeyCreateRequest type used to create an ssh key -type SSHKeyCreateRequest struct { - Label string `json:"label"` - Key string `json:"key"` - ProjectID string `json:"-"` -} - -func (s SSHKeyCreateRequest) String() string { - return Stringify(s) -} - -// SSHKeyUpdateRequest type used to update an ssh key -type SSHKeyUpdateRequest struct { - Label *string `json:"label,omitempty"` - Key *string `json:"key,omitempty"` -} - -func (s SSHKeyUpdateRequest) String() string { - return Stringify(s) -} - -// SSHKeyServiceOp implements SSHKeyService -type SSHKeyServiceOp struct { - client *Client -} - -func (s *SSHKeyServiceOp) list(url string) ([]SSHKey, *Response, error) { - root := new(sshKeyRoot) - - resp, err := s.client.DoRequest("GET", url, nil, root) - if err != nil { - return nil, resp, err - } - - return root.SSHKeys, resp, err -} - -// ProjectList lists ssh keys of a project -// Deprecated: Use ProjectServiceOp.ListSSHKeys -func (s *SSHKeyServiceOp) ProjectList(projectID string) ([]SSHKey, *Response, error) { - return s.list(path.Join(projectBasePath, projectID, sshKeyBasePath)) - -} - -// List returns a user's ssh keys -func (s *SSHKeyServiceOp) List() ([]SSHKey, *Response, error) { - return s.list(sshKeyBasePath) -} - -// Get returns an ssh key by id -func (s *SSHKeyServiceOp) Get(sshKeyID string, opts *GetOptions) (*SSHKey, *Response, error) { - endpointPath := path.Join(sshKeyBasePath, sshKeyID) - apiPathQuery := opts.WithQuery(endpointPath) - sshKey := new(SSHKey) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, sshKey) - if err != nil { - return nil, resp, err - } - - return sshKey, resp, err -} - -// Create creates a new ssh key -func (s *SSHKeyServiceOp) Create(createRequest *SSHKeyCreateRequest) (*SSHKey, *Response, error) { - urlPath := sshKeyBasePath - if createRequest.ProjectID != "" { - urlPath = path.Join(projectBasePath, createRequest.ProjectID, sshKeyBasePath) - } - sshKey := new(SSHKey) - - resp, err := s.client.DoRequest("POST", urlPath, createRequest, sshKey) - if err != nil { - return nil, resp, err - } - - return sshKey, resp, err -} - -// Update updates an ssh key -func (s *SSHKeyServiceOp) Update(id string, updateRequest *SSHKeyUpdateRequest) (*SSHKey, *Response, error) { - if updateRequest.Label == nil && updateRequest.Key == nil { - return nil, nil, fmt.Errorf("You must set either Label or Key string for SSH Key update") - } - apiPath := path.Join(sshKeyBasePath, id) - - sshKey := new(SSHKey) - - resp, err := s.client.DoRequest("PATCH", apiPath, updateRequest, sshKey) - if err != nil { - return nil, resp, err - } - - return sshKey, resp, err -} - -// Delete deletes an ssh key -func (s *SSHKeyServiceOp) Delete(sshKeyID string) (*Response, error) { - apiPath := path.Join(sshKeyBasePath, sshKeyID) - - return s.client.DoRequest("DELETE", apiPath, nil, nil) -} diff --git a/vendor/github.com/packethost/packngo/timestamp.go b/vendor/github.com/packethost/packngo/timestamp.go deleted file mode 100644 index c3320ed6..00000000 --- a/vendor/github.com/packethost/packngo/timestamp.go +++ /dev/null @@ -1,35 +0,0 @@ -package packngo - -import ( - "strconv" - "time" -) - -// Timestamp represents a time that can be unmarshalled from a JSON string -// formatted as either an RFC3339 or Unix timestamp. All -// exported methods of time.Time can be called on Timestamp. -type Timestamp struct { - time.Time -} - -func (t Timestamp) String() string { - return t.Time.String() -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -// Time is expected in RFC3339 or Unix format. -func (t *Timestamp) UnmarshalJSON(data []byte) (err error) { - str := string(data) - i, err := strconv.ParseInt(str, 10, 64) - if err == nil { - t.Time = time.Unix(i, 0) - } else { - t.Time, err = time.Parse(`"`+time.RFC3339+`"`, str) - } - return -} - -// Equal reports whether t and u are equal based on time.Equal -func (t Timestamp) Equal(u Timestamp) bool { - return t.Time.Equal(u.Time) -} diff --git a/vendor/github.com/packethost/packngo/two_factor_auth.go b/vendor/github.com/packethost/packngo/two_factor_auth.go deleted file mode 100644 index 5064b09f..00000000 --- a/vendor/github.com/packethost/packngo/two_factor_auth.go +++ /dev/null @@ -1,56 +0,0 @@ -package packngo - -const twoFactorAuthAppPath = "/user/otp/app" -const twoFactorAuthSmsPath = "/user/otp/sms" - -// TwoFactorAuthService interface defines available two factor authentication functions -type TwoFactorAuthService interface { - EnableApp(string) (*Response, error) - DisableApp(string) (*Response, error) - EnableSms(string) (*Response, error) - DisableSms(string) (*Response, error) - ReceiveSms() (*Response, error) - SeedApp() (string, *Response, error) -} - -// TwoFactorAuthServiceOp implements TwoFactorAuthService -type TwoFactorAuthServiceOp struct { - client *Client -} - -// EnableApp function enables two factor auth using authenticatior app -func (s *TwoFactorAuthServiceOp) EnableApp(token string) (resp *Response, err error) { - headers := map[string]string{"x-otp-token": token} - return s.client.DoRequestWithHeader("POST", headers, twoFactorAuthAppPath, nil, nil) -} - -// EnableSms function enables two factor auth using sms -func (s *TwoFactorAuthServiceOp) EnableSms(token string) (resp *Response, err error) { - headers := map[string]string{"x-otp-token": token} - return s.client.DoRequestWithHeader("POST", headers, twoFactorAuthSmsPath, nil, nil) -} - -// ReceiveSms orders the auth service to issue an SMS token -func (s *TwoFactorAuthServiceOp) ReceiveSms() (resp *Response, err error) { - return s.client.DoRequest("POST", twoFactorAuthSmsPath+"/receive", nil, nil) -} - -// DisableApp function disables two factor auth using -func (s *TwoFactorAuthServiceOp) DisableApp(token string) (resp *Response, err error) { - headers := map[string]string{"x-otp-token": token} - return s.client.DoRequestWithHeader("DELETE", headers, twoFactorAuthAppPath, nil, nil) -} - -// DisableSms function disables two factor auth using -func (s *TwoFactorAuthServiceOp) DisableSms(token string) (resp *Response, err error) { - headers := map[string]string{"x-otp-token": token} - return s.client.DoRequestWithHeader("DELETE", headers, twoFactorAuthSmsPath, nil, nil) -} - -// SeedApp orders the auth service to issue a token via google authenticator -func (s *TwoFactorAuthServiceOp) SeedApp() (otpURI string, resp *Response, err error) { - ret := &map[string]string{} - resp, err = s.client.DoRequest("POST", twoFactorAuthAppPath+"/receive", nil, ret) - - return (*ret)["otp_uri"], resp, err -} diff --git a/vendor/github.com/packethost/packngo/user.go b/vendor/github.com/packethost/packngo/user.go deleted file mode 100644 index 6132e23c..00000000 --- a/vendor/github.com/packethost/packngo/user.go +++ /dev/null @@ -1,101 +0,0 @@ -package packngo - -import "path" - -const usersBasePath = "/users" -const userBasePath = "/user" - -// UserService interface defines available user methods -type UserService interface { - List(*ListOptions) ([]User, *Response, error) - Get(string, *GetOptions) (*User, *Response, error) - Current() (*User, *Response, error) -} - -type usersRoot struct { - Users []User `json:"users"` - Meta meta `json:"meta"` -} - -// User represents an Equinix Metal user -type User struct { - ID string `json:"id"` - FirstName string `json:"first_name,omitempty"` - LastName string `json:"last_name,omitempty"` - FullName string `json:"full_name,omitempty"` - Email string `json:"email,omitempty"` - TwoFactor string `json:"two_factor_auth,omitempty"` - DefaultOrganizationID string `json:"default_organization_id,omitempty"` - AvatarURL string `json:"avatar_url,omitempty"` - Facebook string `json:"twitter,omitempty"` - Twitter string `json:"facebook,omitempty"` - LinkedIn string `json:"linkedin,omitempty"` - Created string `json:"created_at,omitempty"` - Updated string `json:"updated_at,omitempty"` - TimeZone string `json:"timezone,omitempty"` - Emails []Email `json:"emails,omitempty"` - PhoneNumber string `json:"phone_number,omitempty"` - URL string `json:"href,omitempty"` - - // VPN indicates if Doorman VPN service is enabled for the user. - // - // Deprecated: As of March 31, 2021, Doorman service is no longer - // available. See https://metal.equinix.com/developers/docs/accounts/doorman/ - // for more details. - VPN bool `json:"vpn"` -} - -func (u User) String() string { - return Stringify(u) -} - -// UserServiceOp implements UserService -type UserServiceOp struct { - client *Client -} - -// Get method gets a user by userID -func (s *UserServiceOp) List(opts *ListOptions) (users []User, resp *Response, err error) { - apiPathQuery := opts.WithQuery(usersBasePath) - - for { - subset := new(usersRoot) - - resp, err = s.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - users = append(users, subset.Users...) - - if apiPathQuery = nextPage(subset.Meta, opts); apiPathQuery != "" { - continue - } - return - } -} - -// Returns the user object for the currently logged-in user. -func (s *UserServiceOp) Current() (*User, *Response, error) { - user := new(User) - - resp, err := s.client.DoRequest("GET", userBasePath, nil, user) - if err != nil { - return nil, resp, err - } - - return user, resp, err -} - -func (s *UserServiceOp) Get(userID string, opts *GetOptions) (*User, *Response, error) { - endpointPath := path.Join(usersBasePath, userID) - apiPathQuery := opts.WithQuery(endpointPath) - user := new(User) - - resp, err := s.client.DoRequest("GET", apiPathQuery, nil, user) - if err != nil { - return nil, resp, err - } - - return user, resp, err -} diff --git a/vendor/github.com/packethost/packngo/utils.go b/vendor/github.com/packethost/packngo/utils.go deleted file mode 100644 index 42124ba4..00000000 --- a/vendor/github.com/packethost/packngo/utils.go +++ /dev/null @@ -1,156 +0,0 @@ -package packngo - -import ( - "bytes" - "fmt" - "io" - "reflect" -) - -var ( - timestampType = reflect.TypeOf(Timestamp{}) - - // Facilities DEPRECATED Use Facilities.List - Facilities = []string{ - "yyz1", "nrt1", "atl1", "mrs1", "hkg1", "ams1", - "ewr1", "sin1", "dfw1", "lax1", "syd1", "sjc1", - "ord1", "iad1", "fra1", "sea1", "dfw2"} - - // FacilityFeatures DEPRECATED Use Facilities.List - FacilityFeatures = []string{ - "baremetal", "layer_2", "backend_transfer", "storage", "global_ipv4"} - - // UtilizationLevels DEPRECATED - UtilizationLevels = []string{"unavailable", "critical", "limited", "normal"} - - // DevicePlans DEPRECATED Use Plans.List - DevicePlans = []string{"c2.medium.x86", "g2.large.x86", - "m2.xlarge.x86", "x2.xlarge.x86", "baremetal_2a", "baremetal_2a2", - "baremetal_1", "baremetal_3", "baremetal_2", "baremetal_s", - "baremetal_0", "baremetal_1e", - } -) - -// Stringify creates a string representation of the provided message -// DEPRECATED This is used internally and should not be exported by packngo -func Stringify(message interface{}) string { - var buf bytes.Buffer - v := reflect.ValueOf(message) - // TODO(displague) errors here are not reported - _ = stringifyValue(&buf, v) - return buf.String() -} - -// StreamToString converts a reader to a string -// DEPRECATED This is unused and should not be exported by packngo -func StreamToString(stream io.Reader) (string, error) { - buf := new(bytes.Buffer) - if _, err := buf.ReadFrom(stream); err != nil { - return "", err - } - return buf.String(), nil -} - -// contains tells whether a contains x. -func contains(a []string, x string) bool { - for _, n := range a { - if x == n { - return true - } - } - return false -} - -// stringifyValue was graciously cargoculted from the goprotubuf library -func stringifyValue(w io.Writer, val reflect.Value) error { - if val.Kind() == reflect.Ptr && val.IsNil() { - _, err := w.Write([]byte("")) - return err - } - - v := reflect.Indirect(val) - - switch v.Kind() { - case reflect.String: - if _, err := fmt.Fprintf(w, `"%s"`, v); err != nil { - return err - } - case reflect.Slice: - if _, err := w.Write([]byte{'['}); err != nil { - return err - } - for i := 0; i < v.Len(); i++ { - if i > 0 { - if _, err := w.Write([]byte{' '}); err != nil { - return err - } - } - - if err := stringifyValue(w, v.Index(i)); err != nil { - return err - } - } - - if _, err := w.Write([]byte{']'}); err != nil { - return err - } - return nil - case reflect.Struct: - if v.Type().Name() != "" { - if _, err := w.Write([]byte(v.Type().String())); err != nil { - return err - } - } - - // special handling of Timestamp values - if v.Type() == timestampType { - _, err := fmt.Fprintf(w, "{%s}", v.Interface()) - return err - } - - if _, err := w.Write([]byte{'{'}); err != nil { - return err - } - - var sep bool - for i := 0; i < v.NumField(); i++ { - fv := v.Field(i) - if fv.Kind() == reflect.Ptr && fv.IsNil() { - continue - } - if fv.Kind() == reflect.Slice && fv.IsNil() { - continue - } - - if sep { - if _, err := w.Write([]byte(", ")); err != nil { - return err - } - } else { - sep = true - } - - if _, err := w.Write([]byte(v.Type().Field(i).Name)); err != nil { - return err - } - if _, err := w.Write([]byte{':'}); err != nil { - return err - } - - if err := stringifyValue(w, fv); err != nil { - return err - } - } - - if _, err := w.Write([]byte{'}'}); err != nil { - return err - } - default: - if v.CanInterface() { - if _, err := fmt.Fprint(w, v.Interface()); err != nil { - return err - } - } - } - return nil -} diff --git a/vendor/github.com/packethost/packngo/version.go b/vendor/github.com/packethost/packngo/version.go deleted file mode 100644 index 8b39a9f9..00000000 --- a/vendor/github.com/packethost/packngo/version.go +++ /dev/null @@ -1,4 +0,0 @@ -package packngo - -// Version of the packngo package -const Version = "0.9.0" diff --git a/vendor/github.com/packethost/packngo/virtualcircuits.go b/vendor/github.com/packethost/packngo/virtualcircuits.go deleted file mode 100644 index 6b861330..00000000 --- a/vendor/github.com/packethost/packngo/virtualcircuits.go +++ /dev/null @@ -1,88 +0,0 @@ -package packngo - -import "path" - -const ( - virtualCircuitBasePath = "/virtual-circuits" - vcStatusActive = "active" - vcStatusWaiting = "waiting_on_customer_vlan" - //vcStatusActivating = "activating" - //vcStatusDeactivating = "deactivating" - vcStatusActivationFailed = "activation_failed" - vcStatusDeactivationFailed = "dactivation_failed" -) - -type VirtualCircuitService interface { - Create(string, string, string, *VCCreateRequest, *GetOptions) (*VirtualCircuit, *Response, error) - Get(string, *GetOptions) (*VirtualCircuit, *Response, error) - Events(string, *GetOptions) ([]Event, *Response, error) - Delete(string) (*Response, error) - Update(string, *VCUpdateRequest, *GetOptions) (*VirtualCircuit, *Response, error) -} - -type VCUpdateRequest struct { - VirtualNetworkID *string `json:"vnid"` -} - -type VCCreateRequest struct { - VirtualNetworkID string `json:"vnid"` - NniVLAN int `json:"nni_vlan,omitempty"` - Name string `json:"name,omitempty"` -} - -type VirtualCircuitServiceOp struct { - client *Client -} - -type virtualCircuitsRoot struct { - VirtualCircuits []VirtualCircuit `json:"virtual_circuits"` - Meta meta `json:"meta"` -} - -type VirtualCircuit struct { - ID string `json:"id"` - Name string `json:"name,omitempty"` - Status string `json:"status,omitempty"` - VNID int `json:"vnid,omitempty"` - NniVNID int `json:"nni_vnid,omitempty"` - NniVLAN int `json:"nni_vlan,omitempty"` - Project *Project `json:"project,omitempty"` - VirtualNetwork *VirtualNetwork `json:"virtual_network,omitempty"` -} - -func (s *VirtualCircuitServiceOp) do(method, apiPathQuery string, req interface{}) (*VirtualCircuit, *Response, error) { - vc := new(VirtualCircuit) - resp, err := s.client.DoRequest(method, apiPathQuery, req, vc) - if err != nil { - return nil, resp, err - } - return vc, resp, err -} - -func (s *VirtualCircuitServiceOp) Update(vcID string, req *VCUpdateRequest, opts *GetOptions) (*VirtualCircuit, *Response, error) { - endpointPath := path.Join(virtualCircuitBasePath, vcID) - apiPathQuery := opts.WithQuery(endpointPath) - return s.do("PUT", apiPathQuery, req) -} - -func (s *VirtualCircuitServiceOp) Events(id string, opts *GetOptions) ([]Event, *Response, error) { - apiPath := path.Join(virtualCircuitBasePath, id, eventBasePath) - return listEvents(s.client, apiPath, opts) -} - -func (s *VirtualCircuitServiceOp) Get(id string, opts *GetOptions) (*VirtualCircuit, *Response, error) { - endpointPath := path.Join(virtualCircuitBasePath, id) - apiPathQuery := opts.WithQuery(endpointPath) - return s.do("GET", apiPathQuery, nil) -} - -func (s *VirtualCircuitServiceOp) Delete(id string) (*Response, error) { - apiPath := path.Join(virtualCircuitBasePath, id) - return s.client.DoRequest("DELETE", apiPath, nil, nil) -} - -func (s *VirtualCircuitServiceOp) Create(projectID, connID, portID string, request *VCCreateRequest, opts *GetOptions) (*VirtualCircuit, *Response, error) { - endpointPath := path.Join(projectBasePath, projectID, connectionBasePath, connID, portBasePath, portID, virtualCircuitBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - return s.do("POST", apiPathQuery, request) -} diff --git a/vendor/github.com/packethost/packngo/virtualnetworks.go b/vendor/github.com/packethost/packngo/virtualnetworks.go deleted file mode 100644 index 12e2198c..00000000 --- a/vendor/github.com/packethost/packngo/virtualnetworks.go +++ /dev/null @@ -1,108 +0,0 @@ -package packngo - -import ( - "path" -) - -const virtualNetworkBasePath = "/virtual-networks" - -// DevicePortService handles operations on a port which belongs to a particular device -type ProjectVirtualNetworkService interface { - List(projectID string, opts *ListOptions) (*VirtualNetworkListResponse, *Response, error) - Create(*VirtualNetworkCreateRequest) (*VirtualNetwork, *Response, error) - Get(string, *GetOptions) (*VirtualNetwork, *Response, error) - Delete(virtualNetworkID string) (*Response, error) -} - -type VirtualNetwork struct { - ID string `json:"id"` - Description string `json:"description,omitempty"` // TODO: field can be null - VXLAN int `json:"vxlan,omitempty"` - FacilityCode string `json:"facility_code,omitempty"` - MetroCode string `json:"metro_code,omitempty"` - CreatedAt string `json:"created_at,omitempty"` - Href string `json:"href"` - Project *Project `json:"assigned_to,omitempty"` - Facility *Facility `json:"facility,omitempty"` - Metro *Metro `json:"metro,omitempty"` - Instances []*Device `json:"instances,omitempty"` -} - -type ProjectVirtualNetworkServiceOp struct { - client *Client -} - -type VirtualNetworkListResponse struct { - VirtualNetworks []VirtualNetwork `json:"virtual_networks"` -} - -func (i *ProjectVirtualNetworkServiceOp) List(projectID string, opts *ListOptions) (*VirtualNetworkListResponse, *Response, error) { - endpointPath := path.Join(projectBasePath, projectID, virtualNetworkBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - output := new(VirtualNetworkListResponse) - - resp, err := i.client.DoRequest("GET", apiPathQuery, nil, output) - if err != nil { - return nil, nil, err - } - - return output, resp, nil -} - -type VirtualNetworkCreateRequest struct { - // ProjectID of the project where the VLAN will be made available. - ProjectID string `json:"project_id"` - - // Description is a user supplied description of the VLAN. - Description string `json:"description"` - - // TODO: default Description is null when not specified. Permitting *string here would require changing VirtualNetwork.Description to *string too. - - // Facility in which to create the VLAN. Mutually exclusive with Metro. - Facility string `json:"facility,omitempty"` - - // Metro in which to create the VLAN. Mutually exclusive with Facility. - Metro string `json:"metro,omitempty"` - - // VLAN ID may be specified when created in a metro. It is remotely incremented otherwise. Must be unique per Metro. - VLAN int `json:"vlan,omitempty"` -} - -func (i *ProjectVirtualNetworkServiceOp) Get(vlanID string, opts *GetOptions) (*VirtualNetwork, *Response, error) { - endpointPath := path.Join(virtualNetworkBasePath, vlanID) - apiPathQuery := opts.WithQuery(endpointPath) - vlan := new(VirtualNetwork) - - resp, err := i.client.DoRequest("GET", apiPathQuery, nil, vlan) - if err != nil { - return nil, resp, err - } - - return vlan, resp, err -} - -func (i *ProjectVirtualNetworkServiceOp) Create(input *VirtualNetworkCreateRequest) (*VirtualNetwork, *Response, error) { - // TODO: May need to add timestamp to output from 'post' request - // for the 'created_at' attribute of VirtualNetwork struct since - // API response doesn't include it - apiPath := path.Join(projectBasePath, input.ProjectID, virtualNetworkBasePath) - output := new(VirtualNetwork) - - resp, err := i.client.DoRequest("POST", apiPath, input, output) - if err != nil { - return nil, nil, err - } - - return output, resp, nil -} - -func (i *ProjectVirtualNetworkServiceOp) Delete(virtualNetworkID string) (*Response, error) { - apiPath := path.Join(virtualNetworkBasePath, virtualNetworkID) - - resp, err := i.client.DoRequest("DELETE", apiPath, nil, nil) - if err != nil { - return nil, err - } - - return resp, nil -} diff --git a/vendor/github.com/packethost/packngo/volumes.go b/vendor/github.com/packethost/packngo/volumes.go deleted file mode 100644 index b6166787..00000000 --- a/vendor/github.com/packethost/packngo/volumes.go +++ /dev/null @@ -1,231 +0,0 @@ -package packngo - -import ( - "path" -) - -const ( - volumeBasePath = "/storage" - attachmentsBasePath = "/attachments" -) - -// VolumeService interface defines available Volume methods -type VolumeService interface { - List(string, *ListOptions) ([]Volume, *Response, error) - Get(string, *GetOptions) (*Volume, *Response, error) - Update(string, *VolumeUpdateRequest) (*Volume, *Response, error) - Delete(string) (*Response, error) - Create(*VolumeCreateRequest, string) (*Volume, *Response, error) - Lock(string) (*Response, error) - Unlock(string) (*Response, error) -} - -// VolumeAttachmentService defines attachment methdods -type VolumeAttachmentService interface { - Get(string, *GetOptions) (*VolumeAttachment, *Response, error) - Create(string, string) (*VolumeAttachment, *Response, error) - Delete(string) (*Response, error) -} - -type volumesRoot struct { - Volumes []Volume `json:"volumes"` - Meta meta `json:"meta"` -} - -// Volume represents a volume -type Volume struct { - Attachments []*VolumeAttachment `json:"attachments,omitempty"` - BillingCycle string `json:"billing_cycle,omitempty"` - Created string `json:"created_at,omitempty"` - Description string `json:"description,omitempty"` - Facility *Facility `json:"facility,omitempty"` - Href string `json:"href,omitempty"` - ID string `json:"id"` - Locked bool `json:"locked,omitempty"` - Name string `json:"name,omitempty"` - Plan *Plan `json:"plan,omitempty"` - Project *Project `json:"project,omitempty"` - Size int `json:"size,omitempty"` - SnapshotPolicies []*SnapshotPolicy `json:"snapshot_policies,omitempty"` - State string `json:"state,omitempty"` - Updated string `json:"updated_at,omitempty"` -} - -// SnapshotPolicy used to execute actions on volume -type SnapshotPolicy struct { - ID string `json:"id"` - Href string `json:"href"` - SnapshotFrequency string `json:"snapshot_frequency,omitempty"` - SnapshotCount int `json:"snapshot_count,omitempty"` -} - -func (v Volume) String() string { - return Stringify(v) -} - -// VolumeCreateRequest type used to create an Equinix Metal volume -type VolumeCreateRequest struct { - BillingCycle string `json:"billing_cycle"` - Description string `json:"description,omitempty"` - Locked bool `json:"locked,omitempty"` - Size int `json:"size"` - PlanID string `json:"plan_id"` - FacilityID string `json:"facility_id"` - SnapshotPolicies []*SnapshotPolicy `json:"snapshot_policies,omitempty"` -} - -func (v VolumeCreateRequest) String() string { - return Stringify(v) -} - -// VolumeUpdateRequest type used to update an Equinix Metal volume -type VolumeUpdateRequest struct { - Description *string `json:"description,omitempty"` - PlanID *string `json:"plan_id,omitempty"` - Size *int `json:"size,omitempty"` - BillingCycle *string `json:"billing_cycle,omitempty"` -} - -// VolumeAttachment is a type from Equinix Metal API -type VolumeAttachment struct { - Href string `json:"href"` - ID string `json:"id"` - Volume Volume `json:"volume"` - Device Device `json:"device"` -} - -func (v VolumeUpdateRequest) String() string { - return Stringify(v) -} - -// VolumeAttachmentServiceOp implements VolumeService -type VolumeAttachmentServiceOp struct { - client *Client -} - -// VolumeServiceOp implements VolumeService -type VolumeServiceOp struct { - client *Client -} - -// List returns the volumes for a project -func (v *VolumeServiceOp) List(projectID string, opts *ListOptions) (volumes []Volume, resp *Response, err error) { - endpointPath := path.Join(projectBasePath, projectID, volumeBasePath) - apiPathQuery := opts.WithQuery(endpointPath) - for { - subset := new(volumesRoot) - - resp, err = v.client.DoRequest("GET", apiPathQuery, nil, subset) - if err != nil { - return nil, resp, err - } - - volumes = append(volumes, subset.Volumes...) - - if apiPathQuery = nextPage(subset.Meta, opts); apiPathQuery != "" { - continue - } - return - } -} - -// Get returns a volume by id -func (v *VolumeServiceOp) Get(volumeID string, opts *GetOptions) (*Volume, *Response, error) { - endpointPath := path.Join(volumeBasePath, volumeID) - apiPathQuery := opts.WithQuery(endpointPath) - volume := new(Volume) - - resp, err := v.client.DoRequest("GET", apiPathQuery, nil, volume) - if err != nil { - return nil, resp, err - } - - return volume, resp, err -} - -// Update updates a volume -func (v *VolumeServiceOp) Update(id string, updateRequest *VolumeUpdateRequest) (*Volume, *Response, error) { - apiPath := path.Join(volumeBasePath, id) - volume := new(Volume) - - resp, err := v.client.DoRequest("PATCH", apiPath, updateRequest, volume) - if err != nil { - return nil, resp, err - } - - return volume, resp, err -} - -// Delete deletes a volume -func (v *VolumeServiceOp) Delete(volumeID string) (*Response, error) { - apiPath := path.Join(volumeBasePath, volumeID) - - return v.client.DoRequest("DELETE", apiPath, nil, nil) -} - -// Create creates a new volume for a project -func (v *VolumeServiceOp) Create(createRequest *VolumeCreateRequest, projectID string) (*Volume, *Response, error) { - url := path.Join(projectBasePath, projectID, volumeBasePath) - volume := new(Volume) - - resp, err := v.client.DoRequest("POST", url, createRequest, volume) - if err != nil { - return nil, resp, err - } - - return volume, resp, err -} - -// Attachments - -// Create Attachment, i.e. attach volume to a device -func (v *VolumeAttachmentServiceOp) Create(volumeID, deviceID string) (*VolumeAttachment, *Response, error) { - url := path.Join(volumeBasePath, volumeID, attachmentsBasePath) - volAttachParam := map[string]string{ - "device_id": deviceID, - } - volumeAttachment := new(VolumeAttachment) - - resp, err := v.client.DoRequest("POST", url, volAttachParam, volumeAttachment) - if err != nil { - return nil, resp, err - } - return volumeAttachment, resp, nil -} - -// Get gets attachment by id -func (v *VolumeAttachmentServiceOp) Get(attachmentID string, opts *GetOptions) (*VolumeAttachment, *Response, error) { - endpointPath := path.Join(volumeBasePath, attachmentsBasePath, attachmentID) - apiPathQuery := opts.WithQuery(endpointPath) - volumeAttachment := new(VolumeAttachment) - - resp, err := v.client.DoRequest("GET", apiPathQuery, nil, volumeAttachment) - if err != nil { - return nil, resp, err - } - - return volumeAttachment, resp, nil -} - -// Delete deletes attachment by id -func (v *VolumeAttachmentServiceOp) Delete(attachmentID string) (*Response, error) { - apiPath := path.Join(volumeBasePath, attachmentsBasePath, attachmentID) - - return v.client.DoRequest("DELETE", apiPath, nil, nil) -} - -// Lock sets a volume to "locked" -func (v *VolumeServiceOp) Lock(id string) (*Response, error) { - apiPath := path.Join(volumeBasePath, id) - action := lockType{Locked: true} - - return v.client.DoRequest("PATCH", apiPath, action, nil) -} - -// Unlock sets a volume to "unlocked" -func (v *VolumeServiceOp) Unlock(id string) (*Response, error) { - apiPath := path.Join(volumeBasePath, id) - action := lockType{Locked: false} - - return v.client.DoRequest("PATCH", apiPath, action, nil) -} diff --git a/vendor/github.com/packethost/packngo/vpn.go b/vendor/github.com/packethost/packngo/vpn.go deleted file mode 100644 index 6ae09169..00000000 --- a/vendor/github.com/packethost/packngo/vpn.go +++ /dev/null @@ -1,74 +0,0 @@ -package packngo - -import "fmt" - -const vpnBasePath = "/user/vpn" - -// VPNConfig struct -// -// Deprecated: As of March 31, 2021, Doorman service is no longer -// available. See https://metal.equinix.com/developers/docs/accounts/doorman/ -// for more details. -type VPNConfig struct { - Config string `json:"config,omitempty"` -} - -// VPNService interface defines available VPN functions -// -// Deprecated: As of March 31, 2021, Doorman service is no longer -// available. See https://metal.equinix.com/developers/docs/accounts/doorman/ -// for more details. -type VPNService interface { - Enable() (*Response, error) - Disable() (*Response, error) - Get(code string, getOpt *GetOptions) (*VPNConfig, *Response, error) -} - -// VPNServiceOp implements VPNService -// -// Deprecated: As of March 31, 2021, Doorman service is no longer -// available. See https://metal.equinix.com/developers/docs/accounts/doorman/ -// for more details. -type VPNServiceOp struct { - client *Client -} - -// Enable VPN for current user -// -// Deprecated: As of March 31, 2021, Doorman service is no longer -// available. See https://metal.equinix.com/developers/docs/accounts/doorman/ -// for more details. -func (s *VPNServiceOp) Enable() (resp *Response, err error) { - return s.client.DoRequest("POST", vpnBasePath, nil, nil) -} - -// Disable VPN for current user -// -// Deprecated: As of March 31, 2021, Doorman service is no longer -// available. See https://metal.equinix.com/developers/docs/accounts/doorman/ -// for more details. -func (s *VPNServiceOp) Disable() (resp *Response, err error) { - return s.client.DoRequest("DELETE", vpnBasePath, nil, nil) - -} - -// Get returns the client vpn config for the currently logged-in user. -// -// Deprecated: As of March 31, 2021, Doorman service is no longer -// available. See https://metal.equinix.com/developers/docs/accounts/doorman/ -// for more details. -func (s *VPNServiceOp) Get(code string, opts *GetOptions) (config *VPNConfig, resp *Response, err error) { - params := urlQuery(opts) - config = &VPNConfig{} - apiPath := fmt.Sprintf("%s?code=%s", vpnBasePath, code) - if params != "" { - apiPath += params - } - - resp, err = s.client.DoRequest("GET", apiPath, nil, config) - if err != nil { - return nil, resp, err - } - - return config, resp, err -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 879b21b3..78ea4e50 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -17,6 +17,9 @@ github.com/davecgh/go-spew/spew ## explicit; go 1.13 github.com/emicklei/go-restful/v3 github.com/emicklei/go-restful/v3/log +# github.com/equinix/equinix-sdk-go v0.33.0 +## explicit; go 1.19 +github.com/equinix/equinix-sdk-go/services/metalv1 # github.com/evanphx/json-patch v4.12.0+incompatible ## explicit github.com/evanphx/json-patch @@ -193,9 +196,6 @@ github.com/onsi/gomega/matchers/support/goraph/edge github.com/onsi/gomega/matchers/support/goraph/node github.com/onsi/gomega/matchers/support/goraph/util github.com/onsi/gomega/types -# github.com/packethost/packngo v0.9.0 -## explicit; go 1.15 -github.com/packethost/packngo # github.com/pkg/errors v0.9.1 ## explicit github.com/pkg/errors